FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

LinkBack Thread Tools
Old 04-02-2011, 02:02 PM
Xavier Chantry
Default 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.

Maybe we should build with -O0 in debug mode.

Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
lib/libalpm/dload.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index d9e9488..4ebc868 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;

Thread Tools

All times are GMT. The time now is 09:11 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org