summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko2010-04-03 14:59:12 +0200
committerDenys Vlasenko2010-04-03 14:59:12 +0200
commit4a1884da5322dc9b6fec2b461fe0e8ca6425178a (patch)
treefaf4f085adf32fb13aededa224cc7e06122d6cb2 /networking
parent8a659f6ff9a364fb48fbfa95d70d09134b579627 (diff)
downloadbusybox-4a1884da5322dc9b6fec2b461fe0e8ca6425178a.zip
busybox-4a1884da5322dc9b6fec2b461fe0e8ca6425178a.tar.gz
ftpd: shrink by 33 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/ftpd.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/networking/ftpd.c b/networking/ftpd.c
index 7605d48..375cc0c 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -981,17 +981,23 @@ handle_stou(void)
static uint32_t
cmdio_get_cmd_and_arg(void)
{
- size_t len;
+ int len;
uint32_t cmdval;
char *cmd;
alarm(G.timeout);
free(G.ftp_cmd);
- len = 8 * 1024; /* Paranoia. Peer may send 1 gigabyte long cmd... */
- G.ftp_cmd = cmd = xmalloc_fgets_str_len(stdin, "\r\n", &len);
- if (!cmd)
- exit(0);
+ {
+ /* Paranoia. Peer may send 1 gigabyte long cmd... */
+ /* Using separate len_on_stk instead of len optimizes
+ * code size (allows len to be in CPU register) */
+ size_t len_on_stk = 8 * 1024;
+ G.ftp_cmd = cmd = xmalloc_fgets_str_len(stdin, "\r\n", &len_on_stk);
+ if (!cmd)
+ exit(0);
+ len = len_on_stk;
+ }
/* De-escape telnet: 0xff,0xff => 0xff */
/* RFC959 says that ABOR, STAT, QUIT may be sent even during