diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-01-15 23:16:30 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-01-15 23:16:30 +0000 |
commit | f8f2d3820a9536692b14db7c7c81529f32965ee4 (patch) | |
tree | d5bae80ed39aee11bd82c0ab8f5790101b0182a5 /usr.bin/whois | |
parent | 28b26a240399f40ff7ca8280ec2d38ea961165a5 (diff) |
Fixes from Andrey Matveev:
o Remove bogus cast to char in getopt() switch
o Check for strdup() failure
o Don't list -p option twice in usage()
Diffstat (limited to 'usr.bin/whois')
-rw-r--r-- | usr.bin/whois/whois.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/whois/whois.c b/usr.bin/whois/whois.c index ea8cb0db337..4f13465dd25 100644 --- a/usr.bin/whois/whois.c +++ b/usr.bin/whois/whois.c @@ -1,4 +1,4 @@ -/* $OpenBSD: whois.c,v 1.22 2003/01/07 17:24:08 millert Exp $ */ +/* $OpenBSD: whois.c,v 1.23 2003/01/15 23:16:29 millert Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93"; #else -static const char rcsid[] = "$OpenBSD: whois.c,v 1.22 2003/01/07 17:24:08 millert Exp $"; +static const char rcsid[] = "$OpenBSD: whois.c,v 1.23 2003/01/15 23:16:29 millert Exp $"; #endif #endif /* not lint */ @@ -101,7 +101,7 @@ main(int argc, char **argv) country = host = server = NULL; flags = rval = 0; while ((ch = getopt(argc, argv, "aAc:dgh:ilmp:qQrR6")) != -1) - switch((char)ch) { + switch(ch) { case 'a': host = ANICHOST; break; @@ -246,6 +246,8 @@ whois(const char *query, const char *server, const char *port, int flags) for (i = 0; ip_whois[i] != NULL; i++) { if (strstr(buf, ip_whois[i]) != NULL) { nhost = strdup(ip_whois[i]); + if (nhost == NULL) + err(1, "strdup"); break; } } @@ -304,7 +306,7 @@ usage(void) extern char *__progname; (void)fprintf(stderr, - "usage: %s [-aAdgilmpQrR6] [-c country-code | -h hostname] " + "usage: %s [-aAdgilmQrR6] [-c country-code | -h hostname] " "[-p port] name ...\n", __progname); exit(1); } |