[pacman-dev] [PATCH 2/2] lib/dload.c: remove assumption in continuation logic

Dan McGee dpmcgee at gmail.com
Wed Jun 1 15:30:05 EDT 2011


On Wed, Jun 1, 2011 at 2:24 PM, Dave Reisner <d at falconindy.com> wrote:
> Callers to curl_download_internal now tell us if its okay to continue a
> transfer, so obey this instead of using a heuristic.
>
> Signed-off-by: Dave Reisner <d at falconindy.com>
> ---
>  lib/libalpm/dload.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index 3d90130..c79e5d2 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -202,10 +202,8 @@ static int curl_download_internal(const char *url, const char *localpath,
>                curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
>        }
>
> -       /* TODO: no assuming here. the calling function should tell us what's kosher */
> -       if(!force && stat(destfile, &st) == 0) {
> -               /* assume its a sync, so we're starting from scratch. but, only download
> -                * our local is out of date. */
> +       if(!force && stat(destfile, &st) == 0 && !allow_resume) {
> +               /* start from scratch, but only download our local is out of date. */
"only download if our" ? Missing a word here. Otherwise patch looks
good, although I'd check both of the simple things before doing the
stat.
!force && !allow_resume && stat()

>                curl_easy_setopt(handle->curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
>                curl_easy_setopt(handle->curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
>        } else if(stat(tempfile, &st) == 0 && allow_resume) {
> --
> 1.7.5.2
>
>
>


More information about the pacman-dev mailing list