diff options
author | David Malone <dwmalone@FreeBSD.org> | 2002-02-27 15:22:12 +0000 |
---|---|---|
committer | David Malone <dwmalone@FreeBSD.org> | 2002-02-27 15:22:12 +0000 |
commit | 8f4c8256b2b98bf638cc592a684470a25592df56 (patch) | |
tree | 475e01df6b07b84377728d1aab2a0f34865413e0 /usr.bin/tftp | |
parent | cb83438de4e62e664d6f42d31f1a6a05107721bb (diff) | |
download | src-8f4c8256b2b98bf638cc592a684470a25592df56.tar.gz src-8f4c8256b2b98bf638cc592a684470a25592df56.zip |
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.
Notes
Notes:
svn path=/head/; revision=91387
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 a6076065b1ab..2d29321a54d5 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)); |