diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-07-26 22:43:54 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2006-07-26 22:43:54 +0000 |
commit | e6e11ab4c6cceddb993fb4b1dda8f493f4e52b2c (patch) | |
tree | 9cea70f74f2657c15e0fd849cfaeff0b3c4c27a9 /usr.bin/tftp | |
parent | 0bc761ddd14c237a75247952fac6405ea1fe6387 (diff) |
Make tftp atoi() free.
Diffstat (limited to 'usr.bin/tftp')
-rw-r--r-- | usr.bin/tftp/main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c index 006a6601ecb..33c6009c215 100644 --- a/usr.bin/tftp/main.c +++ b/usr.bin/tftp/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.27 2006/07/26 09:10:03 mglocker Exp $ */ +/* $OpenBSD: main.c,v 1.28 2006/07/26 22:43:53 mglocker Exp $ */ /* $NetBSD: main.c,v 1.6 1995/05/21 16:54:10 mycroft Exp $ */ /* @@ -41,7 +41,7 @@ static const char copyright[] = static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif static const char rcsid[] = - "$OpenBSD: main.c,v 1.27 2006/07/26 09:10:03 mglocker Exp $"; + "$OpenBSD: main.c,v 1.28 2006/07/26 22:43:53 mglocker Exp $"; #endif /* not lint */ /* @@ -222,6 +222,7 @@ void setpeer(int argc, char *argv[]) { struct hostent *host; + const char *errstr; if (argc < 2) { strlcpy(line, "Connect ", sizeof(line)); @@ -253,9 +254,9 @@ setpeer(int argc, char *argv[]) } port = sp->s_port; if (argc == 3) { - port = atoi(argv[2]); - if (port < 0) { - printf("%s: bad port number\n", argv[2]); + port = strtonum(argv[2], 1, 65535, &errstr); + if (errstr) { + printf("%s: port number is %s\n", argv[2], errstr); connected = 0; return; } @@ -544,7 +545,6 @@ settimeout(int argc, char *argv[]) printf("usage: %s value\n", argv[0]); return; } - t = atoi(argv[1]); t = strtonum(argv[1], TIMEOUT_MIN, TIMEOUT_MAX, &errstr); if (errstr) printf("%s: value is %s\n", argv[1], errstr); |