index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Allan McRae <allan@archlinux.org> | 2010-06-27 21:13:01 +1000 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2010-06-30 23:49:48 -0500 |
commit | 41724cbcdef11cb00fcd720c75d399288ea41fd0 (patch) | |
tree | c55ca577292793d9774d661f5fb8339b69f14c49 | |
parent | 96a1255eadd8b1faaffbfc2e9bdb1aa5e46ee04c (diff) |
-rw-r--r-- | lib/libalpm/alpm.h | 1 | ||||
-rw-r--r-- | lib/libalpm/util.c | 10 |
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 33291325..0c01f214 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -522,6 +522,7 @@ enum _pmerrno_t { PM_ERR_FILE_CONFLICTS, /* Misc */ PM_ERR_RETRIEVE, + PM_ERR_WRITE, PM_ERR_INVALID_REGEX, /* External library errors */ PM_ERR_LIBARCHIVE, diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index b033e0a3..fd5bb628 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -143,7 +143,15 @@ int _alpm_copyfile(const char *src, const char *dest) /* do the actual file copy */ while((len = fread(buf, 1, CPBUFSIZE, in))) { - fwrite(buf, 1, len, out); + size_t nwritten = 0; + nwritten = fwrite(buf, 1, len, out); + if((nwritten != len) || ferror(out)) { + pm_errno = PM_ERR_WRITE; + _alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"), + dest, strerror(errno)); + ret = -1; + goto cleanup; + } } /* chmod dest to permissions of src, as long as it is not a symlink */ |