Tighten the snprintf() test to check behaviour on zero-size buffers.
authorMatthias Clasen <maclas@gmx.de>
Thu, 7 Aug 2003 20:48:10 +0000 (20:48 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 7 Aug 2003 20:48:10 +0000 (20:48 +0000)
2003-08-07  Matthias Clasen  <maclas@gmx.de>

* acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
acinclude.m4

index ee06e3f..542f9ca 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2003-08-07  Matthias Clasen  <maclas@gmx.de>
 
+       * acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)
+
        * tests/patterntest.c: Specify test strings in UTF-8, remove all charset conversion.
        Replace the NOISY define by a cmdline arg --noisy.   (#115757)
 
index ee06e3f..542f9ca 100644 (file)
@@ -1,5 +1,7 @@
 2003-08-07  Matthias Clasen  <maclas@gmx.de>
 
+       * acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)
+
        * tests/patterntest.c: Specify test strings in UTF-8, remove all charset conversion.
        Replace the NOISY define by a cmdline arg --noisy.   (#115757)
 
index ee06e3f..542f9ca 100644 (file)
@@ -1,5 +1,7 @@
 2003-08-07  Matthias Clasen  <maclas@gmx.de>
 
+       * acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)
+
        * tests/patterntest.c: Specify test strings in UTF-8, remove all charset conversion.
        Replace the NOISY define by a cmdline arg --noisy.   (#115757)
 
index ee06e3f..542f9ca 100644 (file)
@@ -1,5 +1,7 @@
 2003-08-07  Matthias Clasen  <maclas@gmx.de>
 
+       * acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)
+
        * tests/patterntest.c: Specify test strings in UTF-8, remove all charset conversion.
        Replace the NOISY define by a cmdline arg --noisy.   (#115757)
 
index ee06e3f..542f9ca 100644 (file)
@@ -1,5 +1,7 @@
 2003-08-07  Matthias Clasen  <maclas@gmx.de>
 
+       * acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)
+
        * tests/patterntest.c: Specify test strings in UTF-8, remove all charset conversion.
        Replace the NOISY define by a cmdline arg --noisy.   (#115757)
 
index ee06e3f..542f9ca 100644 (file)
@@ -1,5 +1,7 @@
 2003-08-07  Matthias Clasen  <maclas@gmx.de>
 
+       * acinclude.m4: Tighten the snprintf() test to check behaviour on zero-size buffers.  (#106091)
+
        * tests/patterntest.c: Specify test strings in UTF-8, remove all charset conversion.
        Replace the NOISY define by a cmdline arg --noisy.   (#115757)
 
index ed90b97..4d01801 100644 (file)
@@ -66,6 +66,16 @@ doit()
   if (r != 7)
     exit(1);
 
+  r = snprintf(buffer, 0, "1234567");
+
+  if (r != 7)
+    exit(1);
+
+  r = snprintf(NULL, 0, "1234567");
+
+  if (r != 7)
+    exit(1);
+
   exit(0);
 }
 
@@ -116,40 +126,17 @@ if test $ac_cv_func_printf_unix98 = yes; then
 fi
 ])# AC_FUNC_PRINTF_UNIX98
 
-# Checks the location of the XML Catalog
-# Usage:
-#   JH_PATH_XML_CATALOG
-# Defines XMLCATALOG and XML_CATALOG_FILE substitutions
-AC_DEFUN([JH_PATH_XML_CATALOG],
-[
-  # check for the presence of the XML catalog
-  AC_ARG_WITH([xml-catalog],
-              AC_HELP_STRING([--with-xml-catalog=CATALOG],
-                             [path to xml catalog to use]),,
-              [with_xml_catalog=/etc/xml/catalog])
-  XML_CATALOG_FILE="$with_xml_catalog"
-  AC_MSG_CHECKING([for XML catalog ($XML_CATALOG_FILE)])
-  if test -f "$XML_CATALOG_FILE"; then
-    AC_MSG_RESULT([found])
-  else
-    AC_MSG_RESULT([not found])
-    AC_MSG_ERROR([XML catalog not found])
-  fi
-  AC_SUBST([XML_CATALOG_FILE])
-
-  # check for the xmlcatalog program
-  AC_PATH_PROG(XMLCATALOG, xmlcatalog, no)
-  if test "x$XMLCATALOG" = xno; then
-    AC_MSG_ERROR([could not find xmlcatalog program])
-  fi
-])
-
 # Checks if a particular URI appears in the XML catalog
 # Usage:
 #   JH_CHECK_XML_CATALOG(URI, [FRIENDLY-NAME], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 AC_DEFUN([JH_CHECK_XML_CATALOG],
 [
-  AC_REQUIRE([JH_PATH_XML_CATALOG])dnl
+  AC_ARG_WITH([xml-catalog],
+               AC_HELP_STRING([--with-xml-catalog=CATALOG],
+                              [path to xml catalog to use]),,
+               [with_xml_catalog=/etc/xml/catalog])
+  XML_CATALOG_FILE="$with_xml_catalog"  
+  AC_PATH_PROG(XMLCATALOG, xmlcatalog, /bin/false)
   AC_MSG_CHECKING([for ifelse([$2],,[$1],[$2]) in XML catalog])
   if AC_RUN_LOG([$XMLCATALOG --noout "$XML_CATALOG_FILE" "$1" >&2]); then
     AC_MSG_RESULT([found])