[pacman-dev] [PATCH 1/2] configure.ac: we use fabs now so -lm is needed
Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> --- configure.ac | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index 3299302..9fb9cb0 100644 --- a/configure.ac +++ b/configure.ac @@ -131,6 +131,9 @@ AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false]) AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.13.1) +AC_CHECK_LIB([m], [fabs], , + AC_MSG_ERROR([libm is needed to compile pacman!])) + # Check for libarchive AC_CHECK_LIB([archive], [archive_read_data], , AC_MSG_ERROR([libarchive is needed to compile pacman!])) -- 1.7.4.2
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; -- 1.7.4.2
On Sat, Apr 2, 2011 at 9:02 AM, Xavier Chantry <chantry.xavier@gmail.com> wrote:
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. Bad idea- most errors and warnings in gcc aren't flagged until the optimizer kicks in and finds them, so this would result in a ton of missed warnings.
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; -- 1.7.4.2
participants (2)
-
Dan McGee
-
Xavier Chantry