diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2002-02-27 15:22:12 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2002-02-27 15:22:12 +0000 |
commit | 316f1206014cd3c2921eff1e1c621c97599cd644 (patch) | |
tree | 475e01df6b07b84377728d1aab2a0f34865413e0 /usr.bin/tftp | |
parent | 9df3ba1f33f93f0ff10f82d5dde0791ae337e09e (diff) | |
download | FreeBSD-src-316f1206014cd3c2921eff1e1c621c97599cd644.zip FreeBSD-src-316f1206014cd3c2921eff1e1c621c97599cd644.tar.gz |
1) Move FreeBSD ID below vendor ID and don't compile vendor ID.
2) Cast some numbers we know to be positive to size_t before we MIN them
with the result of a sizeof.
3) Compare result of inet_addr to INADDR_NONE, not -1.
Diffstat (limited to 'usr.bin/tftp')
-rw-r--r-- | usr.bin/tftp/main.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/usr.bin/tftp/main.c b/usr.bin/tftp/main.c index a607606..2d29321 100644 --- a/usr.bin/tftp/main.c +++ b/usr.bin/tftp/main.c @@ -31,19 +31,20 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> - -__FBSDID("$FreeBSD$"); - #ifndef lint static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif +#if 0 #ifndef lint -static const char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; +static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif +#endif + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); /* Many bug fixes are from Jim Guyton <guyton@rand-unix> */ @@ -208,12 +209,12 @@ setpeer(argc, argv) if (host) { peeraddr.sin_family = host->h_addrtype; bcopy(host->h_addr, &peeraddr.sin_addr, - MIN(sizeof(peeraddr.sin_addr), host->h_length)); + MIN(sizeof(peeraddr.sin_addr), (size_t)host->h_length)); strncpy(hostname, host->h_name, sizeof(hostname)); } else { peeraddr.sin_family = AF_INET; peeraddr.sin_addr.s_addr = inet_addr(argv[1]); - if (peeraddr.sin_addr.s_addr == -1) { + if (peeraddr.sin_addr.s_addr == INADDR_NONE) { connected = 0; printf("%s: unknown host\n", argv[1]); return; @@ -354,7 +355,7 @@ put(argc, argv) return; } bcopy(hp->h_addr, (caddr_t)&peeraddr.sin_addr, - MIN(sizeof(peeraddr.sin_addr), hp->h_length)); + MIN(sizeof(peeraddr.sin_addr), (size_t)hp->h_length)); peeraddr.sin_family = hp->h_addrtype; connected = 1; strncpy(hostname, hp->h_name, sizeof(hostname)); @@ -452,7 +453,7 @@ get(argc, argv) continue; } bcopy(hp->h_addr, (caddr_t)&peeraddr.sin_addr, - MIN(sizeof(peeraddr.sin_addr), hp->h_length)); + MIN(sizeof(peeraddr.sin_addr), (size_t)hp->h_length)); peeraddr.sin_family = hp->h_addrtype; connected = 1; strncpy(hostname, hp->h_name, sizeof(hostname)); |