Index: squid/acconfig.h diff -c squid/acconfig.h:1.61.2.3 squid/acconfig.h:1.61.2.4 *** squid/acconfig.h:1.61.2.3 Mon Jul 1 02:55:11 2002 --- squid/acconfig.h Tue Jun 1 02:34:19 2004 *************** *** 283,288 **** --- 283,297 ---- #undef HAVE_STRUCT_MALLINFO /* + * Some systems dont have va_copy */ + #undef HAVE_VA_COPY + + /* + * Some systems support __va_copy */ + #undef HAVE___VA_COPY + + + /* * Do we want to use truncate(2) or unlink(2)? */ #undef USE_TRUNCATE Index: squid/configure.in diff -c squid/configure.in:1.251.2.55 squid/configure.in:1.251.2.56 *** squid/configure.in:1.251.2.55 Mon May 31 17:04:18 2004 --- squid/configure.in Tue Jun 1 02:34:19 2004 *************** *** 1747,1753 **** if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then AM_CONDITIONAL(NEED_OWN_SNPRINTF, true) fi ! dnl IP-Filter support requires ipf header files. These aren't dnl installed by default, so we need to check for them if test "$IPF_TRANSPARENT" ; then --- 1747,1801 ---- if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then AM_CONDITIONAL(NEED_OWN_SNPRINTF, true) fi ! ! dnl ! dnl Test for va_copy ! dnl ! AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy, ! AC_TRY_RUN([ ! #include ! void f (int i, ...) { ! va_list args1, args2; ! va_start (args1, i); ! va_copy (args2, args1); ! if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) ! exit (1); ! va_end (args1); va_end (args2); ! } ! int main() { ! f (0, 42); ! return 0; ! } ! ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no") ! ) ! if test "$ac_cv_func_va_copy" = "yes" ; then ! AC_DEFINE(HAVE_VA_COPY) ! fi ! ! dnl ! dnl Some systems support __va_copy ! dnl ! AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy, ! AC_TRY_RUN([ ! #include ! void f (int i, ...) { ! va_list args1, args2; ! va_start (args1, i); ! __va_copy (args2, args1); ! if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) ! exit (1); ! va_end (args1); va_end (args2); ! } ! int main() { ! f (0, 42); ! return 0; ! } ! ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no") ! ) ! if test "$ac_cv_func___va_copy" = "yes" ; then ! AC_DEFINE(HAVE___VA_COPY) ! fi ! dnl IP-Filter support requires ipf header files. These aren't dnl installed by default, so we need to check for them if test "$IPF_TRANSPARENT" ; then Index: squid/src/MemBuf.c diff -c squid/src/MemBuf.c:1.28 squid/src/MemBuf.c:1.28.2.2 *** squid/src/MemBuf.c:1.28 Fri Apr 20 15:26:22 2001 --- squid/src/MemBuf.c Sun Jun 6 09:07:16 2004 *************** *** 98,106 **** * } */ - #include "squid.h" /* local constants */ /* default values for buffer sizes, used by memBufDefInit */ --- 98,114 ---- * } */ #include "squid.h" + #ifdef VA_COPY + #undef VA_COPY + #endif + #if defined HAVE_VA_COPY + #define VA_COPY va_copy + #elif defined HAVE___VA_COPY + #define VA_COPY __va_copy + #endif + /* local constants */ /* default values for buffer sizes, used by memBufDefInit */ *************** *** 228,233 **** --- 236,244 ---- void memBufVPrintf(MemBuf * mb, const char *fmt, va_list vargs) { + #if defined VA_COPY + va_list ap; + #endif int sz = 0; assert(mb && fmt); assert(mb->buf); *************** *** 236,242 **** --- 247,263 ---- while (mb->capacity <= mb->max_capacity) { mb_size_t free_space = mb->capacity - mb->size; /* put as much as we can */ + + #if defined VA_COPY + VA_COPY(ap, vargs); /* Fix of bug 753. The value of vargs is undefined + * * after vsnprintf() returns. Make a copy of vargs + * * incase we loop around and call vsnprintf() again. + */ + sz = vsnprintf(mb->buf + mb->size, free_space, fmt, ap); + va_end(ap); + #else sz = vsnprintf(mb->buf + mb->size, free_space, fmt, vargs); + #endif /* check for possible overflow */ /* snprintf on Linuz returns -1 on overflows */ /* snprintf on FreeBSD returns at least free_space on overflows */ Index: squid/configure diff -c squid/configure:1.248.2.57 squid/configure:1.248.2.58 *** squid/configure:1.248.2.57 Mon May 31 18:11:30 2004 --- squid/configure Tue Jun 1 18:11:29 2004 *************** *** 7599,7605 **** NEED_OWN_SNPRINTF_FALSE= fi fi ! if test "$IPF_TRANSPARENT" ; then echo $ac_n "checking if IP-Filter header files are installed""... $ac_c" 1>&6 echo "configure:7606: checking if IP-Filter header files are installed">&5 --- 7599,7705 ---- NEED_OWN_SNPRINTF_FALSE= fi fi ! ! echo $ac_n "checking if va_copy is implemented""... $ac_c" 1>&6 ! echo "configure:7605: checking if va_copy is implemented">&5 ! if eval "test \"`echo '$''{'ac_cv_func_va_copy'+set}'`\" = set"; then ! echo $ac_n "(cached) $ac_c" 1>&6 ! else ! if test "$cross_compiling" = yes; then ! { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ! else ! cat> conftest.$ac_ext < ! void f (int i, ...) { ! va_list args1, args2; ! va_start (args1, i); ! va_copy (args2, args1); ! if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) ! exit (1); ! va_end (args1); va_end (args2); ! } ! int main() { ! f (0, 42); ! return 0; ! } ! ! EOF ! if { (eval echo configure:7631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ! then ! ac_cv_func_va_copy="yes" ! else ! echo "configure: failed program was:">&5 ! cat conftest.$ac_ext>&5 ! rm -fr conftest* ! ac_cv_func_va_copy="no" ! fi ! rm -fr conftest* ! fi ! ! ! fi ! ! echo "$ac_t""$ac_cv_func_va_copy" 1>&6 ! if test "$ac_cv_func_va_copy" = "yes" ; then ! cat>> confdefs.h <<\eof ! #define HAVE_VA_COPY 1 ! EOF ! ! fi ! ! echo $ac_n "checking if __va_copy is implemented""... $ac_c" 1>&6 ! echo "configure:7655: checking if __va_copy is implemented">&5 ! if eval "test \"`echo '$''{'ac_cv_func___va_copy'+set}'`\" = set"; then ! echo $ac_n "(cached) $ac_c" 1>&6 ! else ! if test "$cross_compiling" = yes; then ! { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } ! else ! cat> conftest.$ac_ext < ! void f (int i, ...) { ! va_list args1, args2; ! va_start (args1, i); ! __va_copy (args2, args1); ! if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42) ! exit (1); ! va_end (args1); va_end (args2); ! } ! int main() { ! f (0, 42); ! return 0; ! } ! ! EOF ! if { (eval echo configure:7681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null ! then ! ac_cv_func___va_copy="yes" ! else ! echo "configure: failed program was:">&5 ! cat conftest.$ac_ext>&5 ! rm -fr conftest* ! ac_cv_func___va_copy="no" ! fi ! rm -fr conftest* ! fi ! ! ! fi ! ! echo "$ac_t""$ac_cv_func___va_copy" 1>&6 ! if test "$ac_cv_func___va_copy" = "yes" ; then ! cat>> confdefs.h <<\eof ! #define HAVE___VA_COPY 1 ! EOF ! ! fi ! if test "$IPF_TRANSPARENT" ; then echo $ac_n "checking if IP-Filter header files are installed""... $ac_c" 1>&6 echo "configure:7606: checking if IP-Filter header files are installed">&5 Index: squid/include/autoconf.h.in diff -c squid/include/autoconf.h.in:1.109.2.7 squid/include/autoconf.h.in:1.109.2.8 *** squid/include/autoconf.h.in:1.109.2.7 Fri Jan 17 18:46:33 2003 --- squid/include/autoconf.h.in Tue Jun 1 18:11:30 2004 *************** *** 307,312 **** --- 307,320 ---- #undef HAVE_STRUCT_MALLINFO /* + * Some systems dont have va_copy */ + #undef HAVE_VA_COPY + + /* + * Some systems support __va_copy */ + #undef HAVE___VA_COPY + + /* * Do we want to use truncate(2) or unlink(2)? */ #undef USE_TRUNCATE

AltStyle によって変換されたページ (->オリジナル) /