diff options
author | Damien Miller <djm@mindrot.org> | 2014-08-23 17:06:49 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2014-08-23 17:06:49 +1000 |
commit | d244a5816fd1312a33404b436e4dd83594f1119e (patch) | |
tree | d7aad1957e8de52b58cc7629535c5ad75ee9c8b4 /configure.ac | |
parent | 4cec036362a358e398e6a2e6d19d8e5780558634 (diff) |
- (djm) [configure.ac] We now require a working vsnprintf everywhere (not
just for systems that lack asprintf); check for it always and extend
test to catch more brokenness. Fixes builds on Solaris <= 9
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index d93cc6b4..d5b4377b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.581 2014/08/22 08:06:21 djm Exp $ +# $Id: configure.ac,v 1.582 2014/08/23 07:06:49 djm Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) -AC_REVISION($Revision: 1.581 $) +AC_REVISION($Revision: 1.582 $) AC_CONFIG_SRCDIR([ssh.c]) AC_LANG([C]) @@ -1887,11 +1887,9 @@ if test "x$ac_cv_func_snprintf" = "xyes" ; then ) fi -# If we don't have a working asprintf, then we strongly depend on vsnprintf -# returning the right thing on overflow: the number of characters it tried to -# create (as per SUSv3) -if test "x$ac_cv_func_asprintf" != "xyes" && \ - test "x$ac_cv_func_vsnprintf" = "xyes" ; then +# We depend on vsnprintf returning the right thing on overflow: the +# number of characters it tried to create (as per SUSv3) +if test "x$ac_cv_func_vsnprintf" = "xyes" ; then AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow]) AC_RUN_IFELSE( [AC_LANG_PROGRAM([[ @@ -1899,15 +1897,23 @@ if test "x$ac_cv_func_asprintf" != "xyes" && \ #include <stdio.h> #include <stdarg.h> -int x_snprintf(char *str,size_t count,const char *fmt,...) +int x_snprintf(char *str, size_t count, const char *fmt, ...) { - size_t ret; va_list ap; - va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap); + size_t ret; + va_list ap; + + va_start(ap, fmt); + ret = vsnprintf(str, count, fmt, ap); + va_end(ap); return ret; } ]], [[ - char x[1]; - exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1); +char x[1]; +if (x_snprintf(x, 1, "%s %d", "hello", 12345) != 11) + return 1; +if (x_snprintf(NULL, 0, "%s %d", "hello", 12345) != 11) + return 1; +return 0; ]])], [AC_MSG_RESULT([yes])], [ |