summaryrefslogtreecommitdiffstats
path: root/libexec/tftpd
diff options
context:
space:
mode:
authorstefanf <stefanf@FreeBSD.org>2005-02-14 17:59:52 +0000
committerstefanf <stefanf@FreeBSD.org>2005-02-14 17:59:52 +0000
commit08dca4373d4a1de0c7b4d7059f1f6d889bf2f13d (patch)
treef69a5d4f00380cd72b9fa65218ab3a48e784af79 /libexec/tftpd
parent653ce89b7e29517b80423c1362bfa2969c59d220 (diff)
downloadFreeBSD-src-08dca4373d4a1de0c7b4d7059f1f6d889bf2f13d.zip
FreeBSD-src-08dca4373d4a1de0c7b4d7059f1f6d889bf2f13d.tar.gz
- Use socklen_t.
- No need for 'fromlen' to have file scope. - Remove an unused variable.
Diffstat (limited to 'libexec/tftpd')
-rw-r--r--libexec/tftpd/tftpd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c
index dd253e4..84c961c 100644
--- a/libexec/tftpd/tftpd.c
+++ b/libexec/tftpd/tftpd.c
@@ -90,7 +90,6 @@ int max_rexmtval = 2*TIMEOUT;
char buf[PKTSIZE];
char ackbuf[PKTSIZE];
struct sockaddr_storage from;
-int fromlen;
void tftp(struct tftphdr *, int);
static void unmappedaddr(struct sockaddr_in6 *);
@@ -124,10 +123,10 @@ int
main(int argc, char *argv[])
{
struct tftphdr *tp;
+ socklen_t fromlen, len;
int n;
int ch, on;
struct sockaddr_storage me;
- int len;
char *chroot_dir = NULL;
struct passwd *nobody;
const char *chuser = "nobody";
@@ -216,8 +215,7 @@ main(int argc, char *argv[])
* spawn endless instances, clogging the system.
*/
{
- int pid;
- int i, j;
+ int i, pid;
for (i = 1; i < 20; i++) {
pid = fork();
@@ -233,12 +231,11 @@ main(int argc, char *argv[])
* than one tftpd being started up to service
* a single request from a single client.
*/
- j = sizeof from;
+ fromlen = sizeof from;
i = recvfrom(0, buf, sizeof (buf), 0,
- (struct sockaddr *)&from, &j);
+ (struct sockaddr *)&from, &fromlen);
if (i > 0) {
n = i;
- fromlen = j;
}
} else {
break;
@@ -408,7 +405,7 @@ tftp(struct tftphdr *tp, int size)
int i, first = 1, has_options = 0, ecode;
struct formats *pf;
char *filename, *mode, *option, *ccp;
- char fnbuf[PATH_MAX], resolved_fnbuf[PATH_MAX];
+ char fnbuf[PATH_MAX];
cp = tp->th_stuff;
again:
OpenPOWER on IntegriCloud