aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-02-13 13:01:43 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-02-13 13:01:43 +0100
commit779df9f228789034ef23f856f855147bdb729958 (patch)
treec67a49cfd2fae5263241579590ae9cf459829f7e
parent260bd21169843fc00ee294a5f75da9e53cb2bc14 (diff)
downloadbusybox-w32-779df9f228789034ef23f856f855147bdb729958.tar.gz
busybox-w32-779df9f228789034ef23f856f855147bdb729958.tar.bz2
busybox-w32-779df9f228789034ef23f856f855147bdb729958.zip
tftp: code shrink
function old new delta tftp_protocol 1949 1947 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/tftp.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index e74186884..4d608a6fb 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -459,16 +459,14 @@ static int tftp_protocol(
459 } 459 }
460 /* add filename and mode */ 460 /* add filename and mode */
461 /* fill in packet if the filename fits into xbuf */ 461 /* fill in packet if the filename fits into xbuf */
462 len = strlen(remote_file) + 1; 462 len = strlen(remote_file);
463 if (2 + len + sizeof("octet") >= io_bufsize) { 463 if (len + 3 + sizeof("octet") >= io_bufsize) {
464 bb_simple_error_msg("remote filename is too long"); 464 bb_simple_error_msg("remote filename is too long");
465 goto ret; 465 goto ret;
466 } 466 }
467 strcpy(cp, remote_file); 467 cp = stpcpy(cp, remote_file) + 1;
468 cp += len;
469 /* add "mode" part of the packet */ 468 /* add "mode" part of the packet */
470 strcpy(cp, "octet"); 469 cp = stpcpy(cp, "octet");
471 cp += sizeof("octet");
472 470
473# if ENABLE_FEATURE_TFTP_BLOCKSIZE 471# if ENABLE_FEATURE_TFTP_BLOCKSIZE
474 if (blksize == TFTP_BLKSIZE_DEFAULT && !want_transfer_size) 472 if (blksize == TFTP_BLKSIZE_DEFAULT && !want_transfer_size)
@@ -757,7 +755,6 @@ static int tftp_protocol(
757} 755}
758 756
759#if ENABLE_TFTP 757#if ENABLE_TFTP
760
761int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 758int tftp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
762int tftp_main(int argc UNUSED_PARAM, char **argv) 759int tftp_main(int argc UNUSED_PARAM, char **argv)
763{ 760{
@@ -873,7 +870,6 @@ int tftp_main(int argc UNUSED_PARAM, char **argv)
873 } 870 }
874 return result; 871 return result;
875} 872}
876
877#endif /* ENABLE_TFTP */ 873#endif /* ENABLE_TFTP */
878 874
879#if ENABLE_TFTPD 875#if ENABLE_TFTPD
@@ -1010,7 +1006,6 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
1010 strcpy(G_error_pkt_str, error_msg); 1006 strcpy(G_error_pkt_str, error_msg);
1011 goto do_proto; 1007 goto do_proto;
1012} 1008}
1013
1014#endif /* ENABLE_TFTPD */ 1009#endif /* ENABLE_TFTPD */
1015 1010
1016#endif /* ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT */ 1011#endif /* ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT */