Index: acinclude.m4.in =================================================================== RCS file: /home/kde/kde-common/admin/acinclude.m4.in,v retrieving revision 2.305 diff -u -r2.305 acinclude.m4.in --- acinclude.m4.in 3 Dec 2002 10:50:38 -0000 2.305 +++ acinclude.m4.in 8 Dec 2002 02:50:42 -0000 @@ -754,6 +754,40 @@ ]) AC_CHECK_FUNCS([vsnprintf snprintf]) +if test x$ac_cv_func_snprintf = xyes; then + AC_MSG_CHECKING([whether snprintf is safe]) + AC_TRY_RUN([ +#include + +int main() +{ + char buf[11]; + + buf[10] = 'O'; + buf[9] = 'B'; + snprintf(buf, 10, "0123456789"); + if (buf[9]) + return 1; + /* extra paranoia */ + buf[9] = 'B'; + snprintf(buf, 10, "01234%s", "56789"); + if (buf[9]) + return 1; + buf[9] = 'B'; + snprintf(buf, 10, "01234%d", 56789); + if (buf[9]) + return 1; + if (buf[10] != 'O') + return 1; + return 0; +} + ], [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_MSG_ERROR([The snprintf() implementation in your c library +is seriously broken. Upgrade it and try again.])], + [AC_MSG_RESULT(unknown) + AC_MSG_WARN([Cannot test whether snprintf() works (cross-compile)])]) +fi AH_VERBATIM(_TRU64,[ /*