aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tftp/tftp.c
diff options
context:
space:
mode:
authorPhilippe Charnier <charnier@FreeBSD.org>1997-08-14 06:47:41 +0000
committerPhilippe Charnier <charnier@FreeBSD.org>1997-08-14 06:47:41 +0000
commitfd129a0245ccdbed26aee4a48cd7d4b2fa74a99d (patch)
treecd63f766243334124f8b4feb1bdf34fcc551d02a /usr.bin/tftp/tftp.c
parenta85a54896e83e4f9b71045d701b49c21587af1d0 (diff)
downloadsrc-fd129a0245ccdbed26aee4a48cd7d4b2fa74a99d.tar.gz
src-fd129a0245ccdbed26aee4a48cd7d4b2fa74a99d.zip
Use err(3). 100 -> MAXHOSTNAMELEN from OpenBSD.
Obtained from: OpenBSD
Notes
Notes: svn path=/head/; revision=28202
Diffstat (limited to 'usr.bin/tftp/tftp.c')
-rw-r--r--usr.bin/tftp/tftp.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/usr.bin/tftp/tftp.c b/usr.bin/tftp/tftp.c
index 2ca4001b1714..014e28763179 100644
--- a/usr.bin/tftp/tftp.c
+++ b/usr.bin/tftp/tftp.c
@@ -32,7 +32,11 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+ "$Id$";
#endif /* not lint */
/* Many bug fixes are from Jim Guyton <guyton@rand-unix> */
@@ -48,6 +52,7 @@ static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
#include <arpa/tftp.h>
+#include <err.h>
#include <errno.h>
#include <setjmp.h>
#include <signal.h>
@@ -57,8 +62,6 @@ static char sccsid[] = "@(#)tftp.c 8.1 (Berkeley) 6/6/93";
#include "extern.h"
#include "tftpsubs.h"
-extern int errno;
-
extern struct sockaddr_in peeraddr; /* filled in by main */
extern int f; /* the opened socket */
extern int trace;
@@ -128,7 +131,7 @@ send_data:
n = sendto(f, dp, size + 4, 0,
(struct sockaddr *)&peeraddr, sizeof(peeraddr));
if (n != size + 4) {
- perror("tftp: sendto");
+ warn("sendto");
goto abort;
}
read_ahead(file, convert);
@@ -141,7 +144,7 @@ send_data:
} while (n <= 0);
alarm(0);
if (n < 0) {
- perror("tftp: recvfrom");
+ warn("recvfrom");
goto abort;
}
peeraddr.sin_port = from.sin_port; /* added */
@@ -232,7 +235,7 @@ send_ack:
if (sendto(f, ackbuf, size, 0, (struct sockaddr *)&peeraddr,
sizeof(peeraddr)) != size) {
alarm(0);
- perror("tftp: sendto");
+ warn("sendto");
goto abort;
}
write_behind(file, convert);
@@ -245,7 +248,7 @@ send_ack:
} while (n <= 0);
alarm(0);
if (n < 0) {
- perror("tftp: recvfrom");
+ warn("recvfrom");
goto abort;
}
peeraddr.sin_port = from.sin_port; /* added */
@@ -363,7 +366,7 @@ nak(error)
tpacket("sent", tp, length);
if (sendto(f, ackbuf, length, 0, (struct sockaddr *)&peeraddr,
sizeof(peeraddr)) != length)
- perror("nak");
+ warn("nak");
}
static void