From: hniksic Date: Sun, 1 Apr 2001 21:34:40 +0000 (-0700) Subject: [svn] Wget was ignoring an error when getting a directory failed. X-Git-Tag: v1.13~2222 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=20a4341e1a47dad4f3f2b80d12546653e7d4f0d3 [svn] Wget was ignoring an error when getting a directory failed. Fix courtesy Nicolas Lichtmaier. --- diff --git a/src/ChangeLog b/src/ChangeLog index 7c51b192..f3c7f700 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2001-04-01 Nicolas Lichtmaier + + * ftp.c (ftp_get_listing): Propagate error status. + (ftp_retrieve_glob): Use it. + (ftp_loop): Ditto. + 2001-04-01 Nicolas Lichtmaier * main.c (main): Add -C to the string that is the third arg to diff --git a/src/ftp.c b/src/ftp.c index 306dae83..ae96df70 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -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 is specifed in u->dir. */ -static struct fileinfo * -ftp_get_listing (struct urlinfo *u, ccon *con) +uerr_t +ftp_get_listing (struct urlinfo *u, ccon *con, struct fileinfo **f) { - struct fileinfo *f; uerr_t err; char *olocal = u->local; char *list_filename, *ofile; @@ -1191,9 +1190,9 @@ ftp_get_listing (struct urlinfo *u, ccon *con) err = ftp_loop_internal (u, NULL, con); u->local = olocal; if (err == RETROK) - f = ftp_parse_ls (list_filename, con->rs); + *f = ftp_parse_ls (list_filename, con->rs); else - f = NULL; + *f = NULL; if (opt.remove_listing) { if (unlink (list_filename)) @@ -1203,7 +1202,7 @@ ftp_get_listing (struct urlinfo *u, ccon *con) } xfree (list_filename); con->cmd &= ~DO_LIST; - return f; + return err; } 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; - orig = ftp_get_listing (u, con); + res = ftp_get_listing (u, con, &orig); + if (res != RETROK) + return res; start = orig; /* First: weed out that do not conform the global rules given in opt.accepts and opt.rejects. */ @@ -1602,9 +1603,10 @@ ftp_loop (struct urlinfo *u, int *dt) opt.htmlify is 0, of course. :-) */ 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) {