Guard against FreeBSD 6.1 bug.
[pspp] / m4 / printf.m4
index 3ce777c2628a15953a21608b27ca2a2146bc0716..d39b42fd758cc72274bb3faefbda23daa3224871 100644 (file)
@@ -1,4 +1,4 @@
-# printf.m4 serial 4
+# printf.m4 serial 5
 dnl Copyright (C) 2003, 2007 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -118,6 +118,11 @@ int main ()
           && strcmp (result, "0x6.0ap-2 33") != 0
           && strcmp (result, "0xc.14p-3 33") != 0))
     return 1;
+  /* This catches a FreeBSD 6.1 bug.  See
+     <http://lists.gnu.org/archive/html/bug-gnulib/2007-04/msg00107.html> */
+  if (sprintf (buf, "%010a %d", 1.0 / 0.0, 33, 44, 55) < 0
+      || result[0] == '0')
+    return 1;
   /* This catches a MacOS X 10.3.9 (Darwin 7.9) bug.  */
   if (sprintf (buf, "%.1a", 1.999) < 0
       || (strcmp (buf, "0x1.0p+1") != 0