]> sjero.net Git - wget/commitdiff
[svn] Wget was ignoring an error when getting a directory failed.
authorhniksic <devnull@localhost>
Sun, 1 Apr 2001 21:34:40 +0000 (14:34 -0700)
committerhniksic <devnull@localhost>
Sun, 1 Apr 2001 21:34:40 +0000 (14:34 -0700)
Fix courtesy Nicolas Lichtmaier.

src/ChangeLog
src/ftp.c

index 7c51b192903a7cb31bade14e17c41b3ef7d971fe..f3c7f7007d73191de7e11e97ccee2b7e9f8d446c 100644 (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>
 
        * main.c (main): Add -C to the string that is the third arg to
index 306dae83e6116555fd5721956b2db4f407315b6c..ae96df7032e73ce04c1a129a7bb1e0c0634bd235 100644 (file)
--- 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)
            {