]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: fix few compiler warnings
authorSami Kerola <kerolasa@iki.fi>
Sat, 19 Nov 2011 20:52:38 +0000 (21:52 +0100)
committerSami Kerola <sami.kerola@tomtom.com>
Tue, 29 Nov 2011 16:58:00 +0000 (17:58 +0100)
Calling abort() as default seems appropriate as the default should be
impossible to reach.

last.c:355:3: warning: switch missing default case [-Wswitch-default]

And simple line removals.

last.c:110:13: warning: redundant redeclaration of 'optind' [-Wredundant-decls]
last.c:111:15: warning: redundant redeclaration of 'optarg' [-Wredundant-decls]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/last.c

index 50afe35cbe10814e787d3af5ed1af9d4ab2f63d3..734730b3a0509a9da21c13a057fd8515cb53b4d4 100644 (file)
@@ -107,8 +107,6 @@ static char *ttyconv(char *);
 
 int
 main(int argc, char **argv) {
-       extern int      optind;
-       extern char     *optarg;
        int     ch;
 
        setlocale(LC_ALL, "");
@@ -369,7 +367,9 @@ want(struct utmp *bp, int check) {
                        if ((in_addr_t) bp->ut_addr == inet_addr(step->name))
                          return YES;
                        break;
-       }
+               default:
+                       abort();
+               }
        return NO;
 }