1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Fix breakage in ls output parsing. By Larry Jones.

This commit is contained in:
hniksic 2006-05-21 02:10:39 -07:00
parent daa33cc9ae
commit 739cc5ec16
2 changed files with 11 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2006-05-18 Lawrence Jones <lawrence.jones@ugs.com>
* ftp-ls.c (ftp_parse_unix_ls): Correct size parsing, add size
and filename debugging output.
2006-04-28 Mauro Tortonesi <mauro@ferrara.linux.it> 2006-04-28 Mauro Tortonesi <mauro@ferrara.linux.it>
* http.c: If Content-Disposition header is present, allow unique * http.c: If Content-Disposition header is present, allow unique

View File

@ -195,7 +195,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
This tactic is quite dubious when it comes to This tactic is quite dubious when it comes to
internationalization issues (non-English month names), but it internationalization issues (non-English month names), but it
works for now. */ works for now. */
ptok = line; tok = line;
while (ptok = tok, while (ptok = tok,
(tok = strtok (NULL, " ")) != NULL) (tok = strtok (NULL, " ")) != NULL)
{ {
@ -211,25 +211,22 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
{ {
wgint size; wgint size;
/* Back up to the beginning of the previous token /* Parse the previous token with str_to_wgint. */
and parse it with str_to_wgint. */ if (ptok == line)
char *t = ptok;
while (t > line && ISDIGIT (*t))
--t;
if (t == line)
{ {
/* Something has gone wrong during parsing. */ /* Something has gone wrong during parsing. */
error = 1; error = 1;
break; break;
} }
errno = 0; errno = 0;
size = str_to_wgint (t, NULL, 10); size = str_to_wgint (ptok, NULL, 10);
if (size == WGINT_MAX && errno == ERANGE) if (size == WGINT_MAX && errno == ERANGE)
/* Out of range -- ignore the size. #### Should /* Out of range -- ignore the size. #### Should
we refuse to start the download. */ we refuse to start the download. */
cur.size = 0; cur.size = 0;
else else
cur.size = size; cur.size = size;
DEBUGP (("size: %s; ", number_to_static_string(cur.size)));
month = i; month = i;
next = 5; next = 5;
@ -363,7 +360,7 @@ ftp_parse_unix_ls (const char *file, int ignore_perms)
if (!cur.name || (cur.type == FT_SYMLINK && !cur.linkto)) if (!cur.name || (cur.type == FT_SYMLINK && !cur.linkto))
error = 1; error = 1;
DEBUGP (("\n")); DEBUGP (("%s\n", cur.name ? cur.name : ""));
if (error || ignore) if (error || ignore)
{ {