diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2004-04-08 10:27:11 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2004-04-08 10:27:11 +0000 |
commit | 32da885a91e0120dfd4c9334262ff923d824599b (patch) | |
tree | cb34176e687f6f0287c5fe4546aa4b2ca2914f4c | |
parent | 66a56aa028b430a3d20ac47c20dccf2aad3b21a0 (diff) | |
download | busybox-w32-32da885a91e0120dfd4c9334262ff923d824599b.tar.gz busybox-w32-32da885a91e0120dfd4c9334262ff923d824599b.tar.bz2 busybox-w32-32da885a91e0120dfd4c9334262ff923d824599b.zip |
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 5c94c58b8..3fbf6b4c2 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -660,8 +660,6 @@ char *gethdr(char *buf, size_t bufsiz, FILE *fp, int *istrunc) | |||
660 | 660 | ||
661 | static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) | 661 | static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) |
662 | { | 662 | { |
663 | char *p; | ||
664 | |||
665 | if (s1) { | 663 | if (s1) { |
666 | if (!s2) s2=""; | 664 | if (!s2) s2=""; |
667 | fprintf(fp, "%s%s\r\n", s1, s2); | 665 | fprintf(fp, "%s%s\r\n", s1, s2); |
@@ -669,9 +667,15 @@ static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf) | |||
669 | } | 667 | } |
670 | 668 | ||
671 | do { | 669 | do { |
672 | p = fgets(buf, 510, fp); | 670 | char *buf_ptr; |
673 | if (!p) | 671 | |
672 | if (fgets(buf, 510, fp) == NULL) { | ||
674 | bb_perror_msg_and_die("fgets()"); | 673 | bb_perror_msg_and_die("fgets()"); |
674 | } | ||
675 | buf_ptr = strstr(buf, "\r\n"); | ||
676 | if (buf_ptr) { | ||
677 | *buf_ptr = '\0'; | ||
678 | } | ||
675 | } while (! isdigit(buf[0]) || buf[3] != ' '); | 679 | } while (! isdigit(buf[0]) || buf[3] != ' '); |
676 | 680 | ||
677 | return atoi(buf); | 681 | return atoi(buf); |
@@ -846,7 +850,7 @@ progressmeter(int flag) | |||
846 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 850 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
847 | * SUCH DAMAGE. | 851 | * SUCH DAMAGE. |
848 | * | 852 | * |
849 | * $Id: wget.c,v 1.72 2004/03/27 10:02:43 andersen Exp $ | 853 | * $Id: wget.c,v 1.73 2004/04/08 10:27:11 bug1 Exp $ |
850 | */ | 854 | */ |
851 | 855 | ||
852 | 856 | ||