diff options
-rw-r--r-- | networking/tftp.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/networking/tftp.c b/networking/tftp.c index eddb1486b..ef4198be8 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -743,7 +743,7 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) | |||
743 | const char *error_msg; | 743 | const char *error_msg; |
744 | int opt, result, opcode; | 744 | int opt, result, opcode; |
745 | IF_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;) | 745 | IF_FEATURE_TFTP_BLOCKSIZE(int blksize = TFTP_BLKSIZE_DEFAULT;) |
746 | IF_FEATURE_TFTP_BLOCKSIZE(int want_transfer_size = 0;) | 746 | IF_FEATURE_TFTP_BLOCKSIZE(int want_transfer_size;) |
747 | 747 | ||
748 | INIT_G(); | 748 | INIT_G(); |
749 | 749 | ||
@@ -791,6 +791,7 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) | |||
791 | goto err; | 791 | goto err; |
792 | } | 792 | } |
793 | # if ENABLE_FEATURE_TFTP_BLOCKSIZE | 793 | # if ENABLE_FEATURE_TFTP_BLOCKSIZE |
794 | want_transfer_size = 0; | ||
794 | { | 795 | { |
795 | char *res; | 796 | char *res; |
796 | char *opt_str = mode + sizeof("octet"); | 797 | char *opt_str = mode + sizeof("octet"); |
@@ -805,8 +806,10 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) | |||
805 | goto do_proto; | 806 | goto do_proto; |
806 | } | 807 | } |
807 | } | 808 | } |
809 | if (opcode != TFTP_WRQ /* download? */ | ||
808 | /* did client ask us about file size? */ | 810 | /* did client ask us about file size? */ |
809 | if (tftp_get_option("tsize", opt_str, opt_len)) { | 811 | && tftp_get_option("tsize", opt_str, opt_len) |
812 | ) { | ||
810 | want_transfer_size = 1; | 813 | want_transfer_size = 1; |
811 | } | 814 | } |
812 | } | 815 | } |
@@ -821,7 +824,6 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) | |||
821 | goto err; | 824 | goto err; |
822 | } | 825 | } |
823 | IF_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */ | 826 | IF_GETPUT(option_mask32 |= TFTP_OPT_GET;) /* will receive file's data */ |
824 | want_transfer_size = 0; /* do not send file size, it's meaningless */ | ||
825 | } else { | 827 | } else { |
826 | IF_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */ | 828 | IF_GETPUT(option_mask32 |= TFTP_OPT_PUT;) /* will send file's data */ |
827 | } | 829 | } |