Fix an infinite loop with error message '<filename> has sprung into existence'

This commit is contained in:
Giuseppe Scrivano 2010-11-19 17:14:21 +01:00
parent 8c7afaf3bb
commit a2596ccf21
3 changed files with 17 additions and 6 deletions

View File

@ -1,3 +1,14 @@
2010-11-19 Giuseppe Scrivano <gscrivano@gnu.org>
* fttp.c (getftp): Accept new argument `count'. When `count' is
bigger than zero, assume the file can be overwritten.
(ftp_loop_internal): Pass new argument `count' to `getftp'.
* http.c (gethttp): Accept new argument `count'. When `count' is
bigger than zero, assume the file can be overwritten.
(http_loop): Pass new argument `count' to `gethttp'.
Reported by: Evgeny Kapun <abacabadabacaba@gmail.com>.
2010-08-08 Reza Snowdon <vivi@mage.me.uk>
* main.c (main): inserted 'defaults'.

View File

@ -241,7 +241,7 @@ static uerr_t ftp_get_listing (struct url *, ccon *, struct fileinfo **);
and closes the control connection in case of error. */
static uerr_t
getftp (struct url *u, wgint passed_expected_bytes, wgint *qtyread,
wgint restval, ccon *con)
wgint restval, ccon *con, int count)
{
int csock, dtsock, local_sock, res;
uerr_t err = RETROK; /* appease the compiler */
@ -1172,7 +1172,7 @@ Error in server response, closing control connection.\n"));
#endif /* def __VMS [else] */
}
else if (opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct
|| opt.output_document)
|| opt.output_document || count > 0)
{
if (opt.unlink && file_exists_p (con->target))
{
@ -1488,7 +1488,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi
len = f->size;
else
len = 0;
err = getftp (u, len, &qtyread, restval, con);
err = getftp (u, len, &qtyread, restval, con, count);
if (con->csock == -1)
con->st &= ~DONE_CWD;

View File

@ -1494,7 +1494,7 @@ free_hstat (struct http_stat *hs)
server, and u->url will be requested. */
static uerr_t
gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
struct iri *iri)
struct iri *iri, int count)
{
struct request *req;
@ -2479,7 +2479,7 @@ File %s already there; not retrieving.\n\n"), quote (hs->local_file));
fp = fopen (hs->local_file, "ab");
#endif /* def __VMS [else] */
}
else if (ALLOW_CLOBBER)
else if (ALLOW_CLOBBER || count > 0)
{
if (opt.unlink && file_exists_p (hs->local_file))
{
@ -2756,7 +2756,7 @@ Spider mode enabled. Check if remote file exists.\n"));
*dt &= ~SEND_NOCACHE;
/* Try fetching the document, or at least its head. */
err = gethttp (u, &hstat, dt, proxy, iri);
err = gethttp (u, &hstat, dt, proxy, iri, count);
/* Time? */
tms = datetime_str (time (NULL));