From: Glenn L McGrath Date: Tue, 4 May 2004 10:43:34 +0000 (-0000) Subject: Fix size command, safe_strtoul gives and error if the \r is left in, the X-Git-Tag: 1_00_rc1~66 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5ec58285c3990ebab9900295f1a1d32824338719;p=oweals%2Fbusybox.git Fix size command, safe_strtoul gives and error if the \r is left in, the RFC spec says the \r should be there. This fix is the same as a recent wget fix --- diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 2ef0b2c44..f6bd82bc8 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -70,11 +70,16 @@ static int ftpcmd(const char *s1, const char *s2, FILE *stream, char *buf) fprintf(stream, "%s\n", s1); } } - do { + char *buf_ptr; + if (fgets(buf, 510, stream) == NULL) { bb_perror_msg_and_die("fgets()"); } + buf_ptr = strstr(buf, "\r\n"); + if (buf_ptr) { + *buf_ptr = '\0'; + } } while (! isdigit(buf[0]) || buf[3] != ' '); return atoi(buf);