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

Skip rename() on NULL destfile in curl_download_internal()

Avoid a potential segfault that may occur if we use a temporary file and
fail to build the destination file name from the effective URL.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Lukas Fleischer 2011-08-17 16:45:35 +02:00 committed by Dan McGee
parent 3ceef97799
commit 9cddc4ad80

View File

@ -385,6 +385,7 @@ cleanup:
}
if(ret == 0) {
if (destfile) {
if(rename(tempfile, destfile)) {
_alpm_log(handle, ALPM_LOG_ERROR, _("could not rename %s to %s (%s)\n"),
tempfile, destfile, strerror(errno));
@ -392,6 +393,9 @@ cleanup:
} else if(final_file) {
*final_file = strdup(strrchr(destfile, '/') + 1);
}
} else if(final_file) {
*final_file = strdup(strrchr(tempfile, '/') + 1);
}
}
if(dload_interrupted && should_unlink) {