diff options
author | Glenn L McGrath | 2004-04-08 10:27:11 +0000 |
---|---|---|
committer | Glenn L McGrath | 2004-04-08 10:27:11 +0000 |
commit | 32da885a91e0120dfd4c9334262ff923d824599b (patch) | |
tree | cb34176e687f6f0287c5fe4546aa4b2ca2914f4c | |
parent | 66a56aa028b430a3d20ac47c20dccf2aad3b21a0 (diff) | |
download | busybox-32da885a91e0120dfd4c9334262ff923d824599b.zip busybox-32da885a91e0120dfd4c9334262ff923d824599b.tar.gz |
Fix ftp resume
Terminate returned message at <CRLF> so strtoul returns without error
-rw-r--r-- | networking/wget.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/networking/wget.c b/networking/wget.c index 5c94c58..3fbf6b4 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -660,8 +660,6 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) { - char *p; - if (s1) { if (!s2) s2=""; fprintf(fp, "%s%s\r\n", s1, s2); @@ -669,9 +667,15 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) } do { - p = fgets(buf, 510, fp); - if (!p) + char *buf_ptr; + + if (fgets(buf, 510, fp) == 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); @@ -846,7 +850,7 @@ progressmeter(int flag) * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: wget.c,v 1.72 2004/03/27 10:02:43 andersen Exp $ + * $Id: wget.c,v 1.73 2004/04/08 10:27:11 bug1 Exp $ */ |