Only remove .listing if it has been created.

This commit is contained in:
Micah Cowan 2008-04-22 22:28:53 -07:00
parent d6bd8516dc
commit 8896339e8d
2 changed files with 15 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2008-04-22 Rabin Vincent <rabin@rab.in>
* ftp.c (ftp_get_listing): Only remove .listing if it has been
created.
2008-04-22 Alain Guibert <alguibert+bts@free.fr>
* test.h (mu_run_test): Move declaration before statements, for

View File

@ -1325,16 +1325,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);
{
*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;
if (opt.remove_listing)
{
if (unlink (lf))
logprintf (LOG_NOTQUIET, "unlink: %s\n", strerror (errno));
else
logprintf (LOG_VERBOSE, _("Removed `%s'.\n"), lf);
}
xfree (lf);
con->cmd &= ~DO_LIST;
return err;