1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

dload: dont forget to initialize open_mode

That's a funny one, building with optimization levels (with both gcc and
clang) caused open_mode to always be set to "ab", which worked.

This was spotted both with clang-analyzer, and by Jakob who reported a
segfault as he was using an un-optimized build.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Xavier Chantry 2011-04-02 15:53:18 +02:00 committed by Dan McGee
parent 0e03c0849d
commit a461837835

View File

@ -159,7 +159,8 @@ static int curl_download_internal(const char *url, const char *localpath,
{ {
int ret = -1; int ret = -1;
FILE *localf = NULL; FILE *localf = NULL;
const char *open_mode, *useragent; const char *useragent;
const char *open_mode = "wb";
char *destfile, *tempfile; char *destfile, *tempfile;
char hostname[256]; /* RFC1123 states applications should support this length */ char hostname[256]; /* RFC1123 states applications should support this length */
struct stat st; struct stat st;