From a2596ccf21620611a377699482ca4080d22e0987 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 19 Nov 2010 17:14:21 +0100 Subject: [PATCH] Fix an infinite loop with error message ' has sprung into existence' --- src/ChangeLog | 11 +++++++++++ src/ftp.c | 6 +++--- src/http.c | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ed092025..51abb4ce 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2010-11-19 Giuseppe Scrivano + + * 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 . + 2010-08-08 Reza Snowdon * main.c (main): inserted 'defaults'. diff --git a/src/ftp.c b/src/ftp.c index 42884d45..8dddeed8 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -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; diff --git a/src/http.c b/src/http.c index b34e57d0..a0e41cac 100644 --- a/src/http.c +++ b/src/http.c @@ -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)); -- 2.39.2