diff options
author | Dan McGee <dan@archlinux.org> | 2008-11-18 04:47:55 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-11-18 04:47:55 +0100 |
commit | f7192b595881103f145a118d63d1b342ffd740b4 (patch) | |
tree | 85a378fd5bf5b665cc48954eaff826f903543826 /lib/libalpm/dload.c | |
parent | 2890114600baefb6cb1dde513ca3107258b64c92 (diff) | |
download | pacman-f7192b595881103f145a118d63d1b342ffd740b4.tar.gz pacman-f7192b595881103f145a118d63d1b342ffd740b4.tar.xz |
Minor code cleanups
Mostly noticed when compiling libalpm/pacman with ICC.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r-- | lib/libalpm/dload.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index c07040b5..9b082943 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -111,11 +111,11 @@ static int download_internal(const char *url, const char *localpath, FILE *dlf, *localf = NULL; struct url_stat ust; struct stat st; - int chk_resume = 0; - size_t dl_thisfile = 0; + int chk_resume = 0, ret = 0; + size_t dl_thisfile = 0, nread = 0; char *tempfile, *destfile, *filename; - int ret = 0; struct url *fileurl = url_for_string(url); + char buffer[PM_DLBUF_LEN]; if(!fileurl) { return(-1); @@ -200,9 +200,8 @@ static int download_internal(const char *url, const char *localpath, handle->dlcb(filename, 0, ust.size); } - size_t nread = 0; - char buffer[PM_DLBUF_LEN]; while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) { + size_t nwritten = 0; if(ferror(dlf)) { pm_errno = PM_ERR_LIBDOWNLOAD; _alpm_log(PM_LOG_ERROR, _("error downloading '%s': %s\n"), @@ -211,7 +210,6 @@ static int download_internal(const char *url, const char *localpath, goto cleanup; } - size_t nwritten = 0; while(nwritten < nread) { nwritten += fwrite(buffer, 1, (nread - nwritten), localf); if(ferror(localf)) { |