diff options
author | fergus.henderson <fergushenderson@users.noreply.github.com> | 2008-07-29 22:17:30 +0000 |
---|---|---|
committer | fergus.henderson <fergushenderson@users.noreply.github.com> | 2008-07-29 22:17:30 +0000 |
commit | a59ffb549e7e423e48b46726de6563c96646e6b2 (patch) | |
tree | 4f0350bed8d13d2e77f8198b9012d18fabc77d44 /configure.ac | |
parent | 552f18380baae1e607128d4d4a2f7a47b7bf18e4 (diff) | |
download | distcc-git-a59ffb549e7e423e48b46726de6563c96646e6b2.tar.gz |
Fix a bug that caused "make check" to fail: MissingCompiler_Case
was reporting an unexpected exit status: 139 instead of 110.
This was caused by a seg fault in distccd, deep in the bowels of
vsnprintf(), which appears to be due to calling vsnprintf() twice
on the same va_list. The fix is to use va_copy() in src/trace.c.
Of course it's never quite as easy as that. va_copy() exists
only in C99, not in C89. Some implementations have __va_copy()
but not va_copy(). So we need to autoconf it. There was
already an autoconf test for this, but only for __va_copy.
I've moved the code which defined VA_COPY from snprintf.c to
a new header file va_copy.h, and added a VA_COPY_END macro.
Also, fix another bug that I noticed at the same time:
snprintf.c was using va_copy(), but was not matching each
call to va_copy with a corresponding call to va_end(),
as required by the C99 standard.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 4c433ae..0bdd4e9 100644 --- a/configure.ac +++ b/configure.ac @@ -383,12 +383,19 @@ AC_TRY_COMPILE([#define func(a, b...) do { } while (0)], AC_DEFINE(HAVE_VARARG_MACROS, , [Define if your cpp has vararg macros])], [AC_MSG_RESULT(no)]) -AC_CACHE_CHECK([for __va_copy],samba_cv_HAVE_VA_COPY,[ +AC_CACHE_CHECK([for va_copy],dcc_cv_HAVE_VA_COPY,[ +AC_TRY_LINK([#include <stdarg.h> +va_list ap1,ap2;], [va_copy(ap1,ap2);], +dcc_cv_HAVE_VA_COPY=yes,dcc_cv_HAVE_VA_COPY=no)]) +if test x"$dcc_cv_HAVE_VA_COPY" = x"yes"; then + AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available]) +fi +AC_CACHE_CHECK([for __va_copy],dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY,[ AC_TRY_LINK([#include <stdarg.h> va_list ap1,ap2;], [__va_copy(ap1,ap2);], -samba_cv_HAVE_VA_COPY=yes,samba_cv_HAVE_VA_COPY=no)]) -if test x"$samba_cv_HAVE_VA_COPY" = x"yes"; then - AC_DEFINE(HAVE_VA_COPY,1,[Whether __va_copy() is available]) +dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY=yes,dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY=no)]) +if test x"$dcc_cv_HAVE_UNDERSCORE_UNDERSCORE_VA_COPY" = x"yes"; then + AC_DEFINE(HAVE_UNDERSCORE_UNDERSCORE_VA_COPY,1,[Whether __va_copy() is available]) fi AC_CACHE_CHECK([for C99 vsnprintf],rsync_cv_HAVE_C99_VSNPRINTF,[ |