summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-08-19 14:25:09 -0400
committerDan McGee <dan@archlinux.org>2011-08-19 19:00:13 -0500
commiteae363c96fb5ffce8e88cb63c780769b1410a1f9 (patch)
tree2ffb9de2ca0e2fcbedb7516748991b94d54e08f2 /lib
parentd3f135af8f499fbab24b3ad9e76751a29bc4d3f5 (diff)
downloadpacman-eae363c96fb5ffce8e88cb63c780769b1410a1f9.tar.xz
dload: remove code duplication
Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib')
-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));
}
}