summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-08 17:27:18 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2009-11-08 17:27:18 (GMT)
commit6528abeb6af88f40924c85e8cf05dad1d3ab88a5 (patch)
tree8f710206c467b472ba090f307d657b2fbca6b022
parent1e9ac9f6853abb645c8d4a480d4ad6f09d7a8588 (diff)
downloadbusybox-6528abeb6af88f40924c85e8cf05dad1d3ab88a5.tar.gz
busybox-6528abeb6af88f40924c85e8cf05dad1d3ab88a5.tar.bz2
tftpd: another small tweak
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tftp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index eddb148..ef4198b 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -743,7 +743,7 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
const char *error_msg;
int opt, result, opcode;
IF_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;)
- IF_FEATURE_TFTP_BLOCKSIZE(int want_transfer_size = 0;)
+ IF_FEATURE_TFTP_BLOCKSIZE(int want_transfer_size;)
INIT_G();
@@ -791,6 +791,7 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
goto err;
}
# if ENABLE_FEATURE_TFTP_BLOCKSIZE
+ want_transfer_size = 0;
{
char *res;
char *opt_str = mode + sizeof("octet");
@@ -805,8 +806,10 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
goto do_proto;
}
}
+ if (opcode != TFTP_WRQ /* download? */
/* did client ask us about file size? */
- if (tftp_get_option("tsize", opt_str, opt_len)) {
+ && tftp_get_option("tsize", opt_str, opt_len)
+ ) {
want_transfer_size = 1;
}
}
@@ -821,7 +824,6 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
goto err;
}
IF_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */
- want_transfer_size = 0; /* do not send file size, it's meaningless */
} else {
IF_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */
}