index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Xavier Chantry <shiningxc@gmail.com> | 2009-08-08 15:20:24 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-08-08 11:17:24 -0500 |
commit | 3cf0ee98c02e1f40954f0c2c508e16d33ca299ca (patch) | |
tree | 4b666332820637aee645cca30e4b7f40f2865990 /lib/libalpm | |
parent | 68200676d2828f159d5dbdf184c3ad7de42c66d6 (diff) |
-rw-r--r-- | lib/libalpm/dload.c | 14 |
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 4d1f9867..a06cb462 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -214,14 +214,12 @@ static int download_internal(const char *url, const char *localpath, while((nread = fetchIO_read(dlf, buffer, PM_DLBUF_LEN)) > 0) { size_t nwritten = 0; - while(nwritten < nread) { - nwritten += fwrite(buffer, 1, (nread - nwritten), localf); - if(ferror(localf)) { - _alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"), - destfile, strerror(errno)); - ret = -1; - goto cleanup; - } + nwritten = fwrite(buffer, 1, nread, localf); + if((nwritten != nread) || ferror(localf)) { + _alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"), + destfile, strerror(errno)); + ret = -1; + goto cleanup; } dl_thisfile += nread; |