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:
parent
d3f135af8f
commit
eae363c96f
@ -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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user