summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/dload.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-08 19:24:43 +0200
committerDan McGee <dan@archlinux.org>2011-08-08 20:29:45 +0200
commit07a1292721c62f44d89a9fe6a0b093b5e6865b8a (patch)
tree899f60128caa28a7cc5886fc205f0f53768e3d5e /lib/libalpm/dload.c
parentf10aea73e462f05d31de7b55667f58300fb89fa2 (diff)
downloadpacman-07a1292721c62f44d89a9fe6a0b093b5e6865b8a.tar.gz
pacman-07a1292721c62f44d89a9fe6a0b093b5e6865b8a.tar.xz
Check return value of rename() calls
We did a good job checking this in add.c, but not necessarily anywhere else. Fix this up by adding checks into dload.c, remove.c, and conf.c in the frontend. Also add loggers where appropriate and make the message syntax more consistent. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r--lib/libalpm/dload.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 23b8db72..dc4f91e5 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -373,8 +373,11 @@ cleanup:
}
if(ret == 0) {
- rename(tempfile, destfile);
- if(final_file) {
+ if(rename(tempfile, destfile)) {
+ _alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
+ tempfile, destfile, strerror(errno));
+ ret = -1;
+ } else if(final_file) {
*final_file = strdup(strrchr(destfile, '/') + 1);
}
}