From a46183783504e01a505222c47d1f7fccfeec70e9 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Sat, 2 Apr 2011 15:53:18 +0200 Subject: 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 Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index d9e9488a..4ebc868b 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -159,7 +159,8 @@ static int curl_download_internal(const char *url, const char *localpath, { int ret = -1; FILE *localf = NULL; - const char *open_mode, *useragent; + const char *useragent; + const char *open_mode = "wb"; char *destfile, *tempfile; char hostname[256]; /* RFC1123 states applications should support this length */ struct stat st; -- cgit v1.2.3-55-g3dc8