bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] mkstemp.m4 patch


From: Jim Meyering
Subject: [bug-gnulib] mkstemp.m4 patch
Date: Tue, 04 Jan 2005 21:33:02 +0100

I've just checked in this change:

2005-01-04  Jim Meyering  <address@hidden>

        Changes imported from coreutils.
        * mkstemp.m4 (gl_FUNC_MKSTEMP): Rather than using "conftestXXXXXX"
        as the mkstemp template, use a temporary directory and an
        8.3-friendly template to avoid trouble on systems like DJGPP.
        Reported by Juan M. Guerrero via Stepan Kasal.
        * (gl_FUNC_MKSTEMP): Include <unistd.h> for the declaration of close.
        Remove the temporary directory right away, rather than waiting
        for configure's at-exit trap code to do it.
        Suggestion from Stepan Kasal.

Index: m4/mkstemp.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/mkstemp.m4,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -u -r1.11 -r1.12
--- m4/mkstemp.m4       20 Apr 2004 09:05:49 -0000      1.11
+++ m4/mkstemp.m4       4 Jan 2005 20:22:52 -0000       1.12
@@ -1,4 +1,4 @@
-#serial 6
+#serial 8
 
 # On some hosts (e.g., HP-UX 10.20, SunOS 4.1.4, Solaris 2.5.1), mkstemp has a
 # silly limit that it can create no more than 26 files from a given template.
@@ -15,26 +15,29 @@ AC_DEFUN([gl_FUNC_MKSTEMP],
     AC_CACHE_CHECK([for mkstemp limitations],
       gl_cv_func_mkstemp_limitations,
       [
+        mkdir conftest.mkstemp
        AC_TRY_RUN([
-#         include <stdlib.h>
-         int main ()
-         {
-           int i;
-           for (i = 0; i < 70; i++)
-             {
-               char template[] = "conftestXXXXXX";
-               int fd = mkstemp (template);
-               if (fd == -1)
-                 exit (1);
-               close (fd);
-             }
-           exit (0);
-         }
-         ],
-       gl_cv_func_mkstemp_limitations=no,
-       gl_cv_func_mkstemp_limitations=yes,
-       gl_cv_func_mkstemp_limitations=yes
-       )
+#           include <stdlib.h>
+#           include <unistd.h>
+           int main ()
+           {
+             int i;
+             for (i = 0; i < 70; i++)
+               {
+                 char template[] = "conftest.mkstemp/coXXXXXX";
+                 int fd = mkstemp (template);
+                 if (fd == -1)
+                   exit (1);
+                 close (fd);
+               }
+             exit (0);
+           }
+           ],
+         gl_cv_func_mkstemp_limitations=no,
+         gl_cv_func_mkstemp_limitations=yes,
+         gl_cv_func_mkstemp_limitations=yes
+         )
+        rm -rf conftest.mkstemp
       ]
     )
   fi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]