summaryrefslogtreecommitdiff
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorMike Pechkin <mpech@cvs.openbsd.org>2001-07-31 14:32:16 +0000
committerMike Pechkin <mpech@cvs.openbsd.org>2001-07-31 14:32:16 +0000
commit7e869dd08f73eb663a8c4425642b53a970c07585 (patch)
treea02a8c47bc41eb14abe73792f49caf39d68aaff9 /libexec/tftpd
parent6486bc2f1faff9954cb6ccfa3cf8281947133020 (diff)
o) better struct handling;
o) use __progname in openlog(3); o) better ERROR packets handling; millert@ ok
Diffstat (limited to 'libexec/tftpd')
-rw-r--r--libexec/tftpd/tftpd.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index 85faa6fa5f0..97536593ee5 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftpd.c,v 1.18 2001/06/11 15:18:53 mickey Exp $ */
+/* $OpenBSD: tftpd.c,v 1.19 2001/07/31 14:32:15 mpech Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)tftpd.c 5.13 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$OpenBSD: tftpd.c,v 1.18 2001/06/11 15:18:53 mickey Exp $: tftpd.c,v 1.6 1997/02/16 23:49:21 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: tftpd.c,v 1.19 2001/07/31 14:32:15 mpech Exp $: tftpd.c,v 1.6 1997/02/16 23:49:21 deraadt Exp $";
#endif /* not lint */
/*
@@ -140,7 +140,7 @@ main(argc, argv)
int i, j;
int c;
- openlog("tftpd", LOG_PID | LOG_NDELAY, LOG_DAEMON);
+ openlog(__progname, LOG_PID | LOG_NDELAY, LOG_DAEMON);
while ((c = getopt(argc, argv, "cs")) != -1)
switch (c) {
@@ -590,7 +590,7 @@ struct errmsg {
{ EBADID, "Unknown transfer ID" },
{ EEXISTS, "File already exists" },
{ ENOUSER, "No such user" },
- { -1, 0 }
+ { -1, NULL }
};
/*
@@ -617,9 +617,9 @@ nak(error)
pe->e_msg = strerror(error - 100);
tp->th_code = EUNDEF; /* set 'undef' errorcode */
}
- length = strlcpy(tp->th_msg, pe->e_msg, sizeof(buf) - 4);
- if (length >= sizeof(buf) - 4)
- length = sizeof(buf) - 5;
- if (send(peer, buf, length + 5, 0) != length)
+ length = strlcpy(tp->th_msg, pe->e_msg, sizeof(buf)) + 5;
+ if (length > sizeof(buf))
+ length = sizeof(buf);
+ if (send(peer, buf, length, 0) != length)
syslog(LOG_ERR, "nak: %m");
}