summaryrefslogtreecommitdiff
path: root/lib/libalpm/dload.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r--lib/libalpm/dload.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index e181f425..fa7d14c7 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -385,17 +385,17 @@ cleanup:
}
if(ret == 0) {
+ const char *realname = tempfile;
if (destfile) {
+ realname = 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) {
- STRDUP(*final_file, strrchr(destfile, '/') + 1,
- RET_ERR(handle, ALPM_ERR_MEMORY, -1));
}
- } else if(final_file) {
- STRDUP(*final_file, strrchr(tempfile, '/') + 1,
+ }
+ if(ret != -1 && final_file) {
+ STRDUP(*final_file, strrchr(realname, '/') + 1,
RET_ERR(handle, ALPM_ERR_MEMORY, -1));
}
}