summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 9f1285d0..fd5c9289 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -385,12 +385,16 @@ cleanup:
}
if(ret == 0) {
- if(rename(tempfile, destfile)) {
- _alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
- tempfile, destfile, strerror(errno));
- ret = -1;
+ if (destfile) {
+ 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);
+ }
} else if(final_file) {
- *final_file = strdup(strrchr(destfile, '/') + 1);
+ *final_file = strdup(strrchr(tempfile, '/') + 1);
}
}