Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/ftp - add justquit() that always exits. use it to a...



details:   https://anonhg.NetBSD.org/src/rev/8191a07314bb
branches:  trunk
changeset: 996524:8191a07314bb
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Feb 04 04:09:13 2019 +0000

description:
- add justquit() that always exits.  use it to avoid unreachable code.

diffstat:

 usr.bin/ftp/cmds.c   |  13 ++++++++++---
 usr.bin/ftp/extern.h |   3 ++-
 usr.bin/ftp/ftp.c    |   6 +++---
 usr.bin/ftp/main.c   |   8 ++++----
 4 files changed, 19 insertions(+), 11 deletions(-)

diffs (122 lines):

diff -r 43de6d1803c5 -r 8191a07314bb usr.bin/ftp/cmds.c
--- a/usr.bin/ftp/cmds.c        Mon Feb 04 04:05:15 2019 +0000
+++ b/usr.bin/ftp/cmds.c        Mon Feb 04 04:09:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cmds.c,v 1.138 2017/11/20 21:11:36 kre Exp $   */
+/*     $NetBSD: cmds.c,v 1.139 2019/02/04 04:09:13 mrg Exp $   */
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
 #if 0
 static char sccsid[] = "@(#)cmds.c     8.6 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: cmds.c,v 1.138 2017/11/20 21:11:36 kre Exp $");
+__RCSID("$NetBSD: cmds.c,v 1.139 2019/02/04 04:09:13 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -1776,6 +1776,13 @@
        exit(0);
 }
 
+void __dead
+justquit(void)
+{
+
+       quit(0, NULL);
+}
+
 /*
  * Terminate session, but don't exit.
  * May be called with 0, NULL.
@@ -2185,7 +2192,7 @@
                                        }
                                        break;
                                }
-                               /* intentional drop through */
+                               /* FALLTHROUGH */
                        default:
                                *cp2++ = *cp1;
                                break;
diff -r 43de6d1803c5 -r 8191a07314bb usr.bin/ftp/extern.h
--- a/usr.bin/ftp/extern.h      Mon Feb 04 04:05:15 2019 +0000
+++ b/usr.bin/ftp/extern.h      Mon Feb 04 04:09:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.80 2012/07/04 06:09:37 is Exp $   */
+/*     $NetBSD: extern.h,v 1.81 2019/02/04 04:09:13 mrg Exp $  */
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -173,6 +173,7 @@
 void   put(int, char **);
 void   pwd(int, char **);
 void   quit(int, char **);
+void   justquit(void) __dead;
 void   quote(int, char **);
 void   quote1(const char *, int, char **);
 void   recvrequest(const char *, const char *, const char *,
diff -r 43de6d1803c5 -r 8191a07314bb usr.bin/ftp/ftp.c
--- a/usr.bin/ftp/ftp.c Mon Feb 04 04:05:15 2019 +0000
+++ b/usr.bin/ftp/ftp.c Mon Feb 04 04:09:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ftp.c,v 1.167 2016/10/04 15:06:31 joerg Exp $  */
+/*     $NetBSD: ftp.c,v 1.168 2019/02/04 04:09:13 mrg Exp $    */
 
 /*-
  * Copyright (c) 1996-2009 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
 #if 0
 static char sccsid[] = "@(#)ftp.c      8.6 (Berkeley) 10/27/94";
 #else
-__RCSID("$NetBSD: ftp.c,v 1.167 2016/10/04 15:06:31 joerg Exp $");
+__RCSID("$NetBSD: ftp.c,v 1.168 2019/02/04 04:09:13 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -1553,8 +1553,8 @@
                                result = COMPLETE + 1;
                                break;
                        }
+#ifdef INET6
                        /* FALLTHROUGH */
-#ifdef INET6
                case AF_INET6:
                        if (!epsv6 || epsv6bad) {
                                result = COMPLETE + 1;
diff -r 43de6d1803c5 -r 8191a07314bb usr.bin/ftp/main.c
--- a/usr.bin/ftp/main.c        Mon Feb 04 04:05:15 2019 +0000
+++ b/usr.bin/ftp/main.c        Mon Feb 04 04:09:13 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.125 2018/03/04 19:57:41 dholland Exp $      */
+/*     $NetBSD: main.c,v 1.126 2019/02/04 04:09:13 mrg Exp $   */
 
 /*-
  * Copyright (c) 1996-2015 The NetBSD Foundation, Inc.
@@ -98,7 +98,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.6 (Berkeley) 10/9/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.125 2018/03/04 19:57:41 dholland Exp $");
+__RCSID("$NetBSD: main.c,v 1.126 2019/02/04 04:09:13 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -660,7 +660,7 @@
                        case -2:        /* error */
                                if (fromatty)
                                        putc('\n', ttyout);
-                               quit(0, NULL);
+                               justquit();
                                /* NOTREACHED */
                        case -3:        /* too long; try again */
                                fputs("Sorry, input line is too long.\n",
@@ -682,7 +682,7 @@
                        if (buf == NULL || num == 0) {
                                if (fromatty)
                                        putc('\n', ttyout);
-                               quit(0, NULL);
+                               justquit();
                        }
                        if (num >= sizeof(line)) {
                                fputs("Sorry, input line is too long.\n",



Home | Main Index | Thread Index | Old Index