index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dave Reisner <d@falconindy.com> | 2011-03-17 09:01:30 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-23 11:04:42 -0500 |
commit | b9263fb4e1900457c9d5f3cc9e05896653130867 (patch) | |
tree | 483b3751513cb11fc9150cf4f0d28f86e4847fdd /lib/libalpm/dload.c | |
parent | 47e41b2023f0d13f213b771db96297968fe0f280 (diff) |
-rw-r--r-- | lib/libalpm/dload.c | 22 |
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index ba8ca949..7e9c3476 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -95,6 +95,16 @@ static int curl_progress(void *filename, double dltotal, double dlnow, (void)ultotal; (void)ulnow; + /* SIGINT sent, abort by alerting curl */ + if(dload_interrupted) { + return 1; + } + + /* none of what follows matters if the front end has no callback */ + if(handle->dlcb == NULL) { + return 0; + } + if(DOUBLE_EQ(dltotal, 0) || DOUBLE_EQ(prevprogress, dltotal)) { return 0; } @@ -102,18 +112,10 @@ static int curl_progress(void *filename, double dltotal, double dlnow, /* initialize the progress bar here to avoid displaying it when * a repo is up to date and nothing gets downloaded */ if(DOUBLE_EQ(prevprogress, 0)) { - if(handle->dlcb) { - handle->dlcb((const char*)filename, 0, (long)dltotal); - } - } - - if(dload_interrupted) { - return 1; + handle->dlcb((const char*)filename, 0, (long)dltotal); } - if(handle->dlcb) { - handle->dlcb((const char*)filename, (long)dlnow, (long)dltotal); - } + handle->dlcb((const char*)filename, (long)dlnow, (long)dltotal); prevprogress = dlnow; |