]> sjero.net Git - wget/blobdiff - src/ftp.c
Changed some comments related with bug fix #23238, to make things clearer.
[wget] / src / ftp.c
index 0321032168487d2eff9b66a13de03595b531ae4a..3223ea59286b76993af0bb6aaa8479a004106228 100644 (file)
--- a/src/ftp.c
+++ b/src/ftp.c
@@ -1091,7 +1091,9 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
   if (!con->target)
     con->target = url_file_name (u);
 
-  if (opt.noclobber && file_exists_p (con->target))
+  /* If the output_document was given, then this check was already done and
+     the file didn't exist. Hence the !opt.output_document */
+  if (opt.noclobber && !opt.output_document && file_exists_p (con->target))
     {
       logprintf (LOG_VERBOSE,
                  _("File `%s' already there; not retrieving.\n"), con->target);
@@ -1325,16 +1327,18 @@ ftp_get_listing (struct url *u, ccon *con, struct fileinfo **f)
   con->target = old_target;
 
   if (err == RETROK)
-    *f = ftp_parse_ls (lf, con->rs);
-  else
-    *f = NULL;
-  if (opt.remove_listing)
     {
-      if (unlink (lf))
-        logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
-      else
-        logprintf (LOG_VERBOSE, _("Removed `%s'.\n"), lf);
+      *f = ftp_parse_ls (lf, con->rs);
+      if (opt.remove_listing)
+        {
+          if (unlink (lf))
+            logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
+          else
+            logprintf (LOG_VERBOSE, _("Removed `%s'.\n"), lf);
+        }
     }
+  else
+    *f = NULL;
   xfree (lf);
   con->cmd &= ~DO_LIST;
   return err;