1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

dload: remove code duplication

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2011-08-19 14:25:09 -04:00 committed by Dan McGee
parent d3f135af8f
commit eae363c96f

View File

@ -385,17 +385,17 @@ cleanup:
} }
if(ret == 0) { if(ret == 0) {
const char *realname = tempfile;
if (destfile) { if (destfile) {
realname = destfile;
if(rename(tempfile, destfile)) { if(rename(tempfile, destfile)) {
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"), _alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
tempfile, destfile, strerror(errno)); tempfile, destfile, strerror(errno));
ret = -1; 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)); RET_ERR(handle, ALPM_ERR_MEMORY, -1));
} }
} }