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

[svn] Wget was ignoring an error when getting a directory failed.

Fix courtesy Nicolas Lichtmaier.
This commit is contained in:
hniksic 2001-04-01 14:34:40 -07:00
parent 4dbad3a894
commit 20a4341e1a
2 changed files with 17 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2001-04-01 Nicolas Lichtmaier <nick@debian.org>
* ftp.c (ftp_get_listing): Propagate error status.
(ftp_retrieve_glob): Use it.
(ftp_loop): Ditto.
2001-04-01 Nicolas Lichtmaier <nick@debian.org> 2001-04-01 Nicolas Lichtmaier <nick@debian.org>
* main.c (main): Add -C to the string that is the third arg to * main.c (main): Add -C to the string that is the third arg to

View File

@ -1170,10 +1170,9 @@ ftp_loop_internal (struct urlinfo *u, struct fileinfo *f, ccon *con)
/* Return the directory listing in a reusable format. The directory /* Return the directory listing in a reusable format. The directory
is specifed in u->dir. */ is specifed in u->dir. */
static struct fileinfo * uerr_t
ftp_get_listing (struct urlinfo *u, ccon *con) ftp_get_listing (struct urlinfo *u, ccon *con, struct fileinfo **f)
{ {
struct fileinfo *f;
uerr_t err; uerr_t err;
char *olocal = u->local; char *olocal = u->local;
char *list_filename, *ofile; char *list_filename, *ofile;
@ -1191,9 +1190,9 @@ ftp_get_listing (struct urlinfo *u, ccon *con)
err = ftp_loop_internal (u, NULL, con); err = ftp_loop_internal (u, NULL, con);
u->local = olocal; u->local = olocal;
if (err == RETROK) if (err == RETROK)
f = ftp_parse_ls (list_filename, con->rs); *f = ftp_parse_ls (list_filename, con->rs);
else else
f = NULL; *f = NULL;
if (opt.remove_listing) if (opt.remove_listing)
{ {
if (unlink (list_filename)) if (unlink (list_filename))
@ -1203,7 +1202,7 @@ ftp_get_listing (struct urlinfo *u, ccon *con)
} }
xfree (list_filename); xfree (list_filename);
con->cmd &= ~DO_LIST; con->cmd &= ~DO_LIST;
return f; return err;
} }
static uerr_t ftp_retrieve_dirs PARAMS ((struct urlinfo *, struct fileinfo *, static uerr_t ftp_retrieve_dirs PARAMS ((struct urlinfo *, struct fileinfo *,
@ -1501,7 +1500,9 @@ ftp_retrieve_glob (struct urlinfo *u, ccon *con, int action)
con->cmd |= LEAVE_PENDING; con->cmd |= LEAVE_PENDING;
orig = ftp_get_listing (u, con); res = ftp_get_listing (u, con, &orig);
if (res != RETROK)
return res;
start = orig; start = orig;
/* First: weed out that do not conform the global rules given in /* First: weed out that do not conform the global rules given in
opt.accepts and opt.rejects. */ opt.accepts and opt.rejects. */
@ -1602,9 +1603,10 @@ ftp_loop (struct urlinfo *u, int *dt)
opt.htmlify is 0, of course. :-) */ opt.htmlify is 0, of course. :-) */
if (!*u->file && !opt.recursive) if (!*u->file && !opt.recursive)
{ {
struct fileinfo *f = ftp_get_listing (u, &con); struct fileinfo *f;
res = ftp_get_listing (u, &con, &f);
if (f) if (res == RETROK)
{ {
if (opt.htmlify) if (opt.htmlify)
{ {