m4-patches
[Top][All Lists]
Advanced

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

branch-1_4 mkstemp usage


From: Eric Blake
Subject: branch-1_4 mkstemp usage
Date: Thu, 22 Jun 2006 14:53:11 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Now that 1.4.x uses gnulib, we might as well avoid platform bugs in mkstemp.  
Plus, this fixes the bug Bruno noticed about being unable to do 'gnulib-tool --
update' on the 1.4.4b tarball.  Applied:

2006-06-22  Eric Blake  <address@hidden>

        Avoid mkstemp bugs on various platforms.
        * m4/gnulib-cache.c: Augment with gnulib-tool --import mkstemp.
        * src/output.c [! HAVE_MKSTEMP]: Delete.
        * configure.ac (AC_CHECK_FUNCS): Don't check for mkstemp.
        * src/m4.h (mkstemp) [! HAVE_MKSTEMP]: Prototype, if needed.
        * NEWS: Document this.

        * Makefile.am (EXTRA_DIST): Distribute gnulib-cache.m4.
        Reported by Bruno Haible.

Index: Makefile.am
===================================================================
RCS file: /sources/m4/m4/Makefile.am,v
retrieving revision 1.25.2.4
diff -u -r1.25.2.4 Makefile.am
--- Makefile.am 17 Jun 2006 13:11:18 -0000      1.25.2.4
+++ Makefile.am 22 Jun 2006 14:49:56 -0000
@@ -21,7 +21,7 @@
 ## Written by Gary V. Vaughan <address@hidden>
 
 SUBDIRS = examples lib src doc checks
-EXTRA_DIST = bootstrap c-boxes.el Makefile.maint
+EXTRA_DIST = bootstrap c-boxes.el Makefile.maint m4/gnulib-cache.m4
 DISTCLEANFILES = stamp-h
 ## maintainer-clean should remove as much as possible that ./bootstrap can
 ## recreate.  In the m4 directory, keep only gnulib-cache.m4.
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.1.1.1.2.22
diff -u -r1.1.1.1.2.22 NEWS
--- NEWS        18 Jun 2006 21:36:09 -0000      1.1.1.1.2.22
+++ NEWS        22 Jun 2006 14:49:56 -0000
@@ -6,6 +6,8 @@
 
 * Fix sysval on BeOS, OS/2, and other systems that store exit status
   in the low-order byte.
+* The maketemp macro is no longer subject to platform limitations (such as
+  26 or 32 max files from a given template).
 
 Version 1.4.4b - 17 June 2006, by Eric Blake  (CVS version 1.4.4a)
 
Index: configure.ac
===================================================================
RCS file: /sources/m4/m4/configure.ac,v
retrieving revision 1.36.2.15
diff -u -r1.36.2.15 configure.ac
--- configure.ac        22 Jun 2006 03:29:36 -0000      1.36.2.15
+++ configure.ac        22 Jun 2006 14:49:56 -0000
@@ -46,7 +46,7 @@
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 
-AC_CHECK_FUNCS([mkstemp sigaction sigaltstack sigstack sigvec strerror 
tmpfile])
+AC_CHECK_FUNCS([sigaction sigaltstack sigstack sigvec strerror tmpfile])
 
 M4_INIT
 
Index: m4/gnulib-cache.m4
===================================================================
RCS file: /sources/m4/m4/m4/Attic/gnulib-cache.m4,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 gnulib-cache.m4
--- m4/gnulib-cache.m4  15 Jun 2006 13:08:46 -0000      1.1.2.1
+++ m4/gnulib-cache.m4  22 Jun 2006 14:49:56 -0000
@@ -15,10 +15,10 @@
 
 
 # Specification in the form of a command-line invocation:
-#   gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --
aux-dir=. --macro-prefix=M4 alloca error getopt obstack regex strtol xalloc
+#   gnulib-tool --import --dir=. --lib=libm4 --source-base=lib --m4-base=m4 --
aux-dir=. --macro-prefix=M4 alloca error getopt mkstemp obstack regex strtol 
xalloc
 
 # Specification in the form of a few gnulib-tool.m4 macro invocations:
-gl_MODULES([alloca error getopt obstack regex strtol xalloc])
+gl_MODULES([alloca error getopt mkstemp obstack regex strtol xalloc])
 gl_AVOID([])
 gl_SOURCE_BASE([lib])
 gl_M4_BASE([m4])
Index: src/m4.h
===================================================================
RCS file: /sources/m4/m4/src/m4.h,v
retrieving revision 1.1.1.1.2.9
diff -u -r1.1.1.1.2.9 m4.h
--- src/m4.h    15 Jun 2006 21:51:37 -0000      1.1.1.1.2.9
+++ src/m4.h    22 Jun 2006 14:49:56 -0000
@@ -116,7 +116,9 @@
 typedef int boolean;
 #endif
 
-char *mktemp ();
+#if ! HAVE_MKSTEMP
+int mkstemp (char *);
+#endif
 
 /* Various declarations.  */
 
Index: src/output.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/output.c,v
retrieving revision 1.1.1.1.2.4
diff -u -r1.1.1.1.2.4 output.c
--- src/output.c        1 May 2005 11:54:12 -0000       1.1.1.1.2.4
+++ src/output.c        22 Jun 2006 14:49:56 -0000
@@ -1,6 +1,6 @@
 /* GNU m4 -- A simple macro processor
 
-   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005 Free
+   Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2004, 2005, 2006 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -103,22 +103,6 @@
   output_unused = 0;
 }
 
-#ifndef HAVE_MKSTEMP
-
-/* This implementation of mkstemp(3) does not avoid any races, but its
-   there.  */
-
-#include <fcntl.h>
-
-int
-mkstemp (const char *tmpl)
-{
-  mktemp (tmpl);
-  return open (tmpl, O_RDWR | O_TRUNC | O_CREAT, 0600);
-}
-
-#endif /* not HAVE_MKSTEMP */
-
 #ifndef HAVE_TMPFILE
 
 /* Implement tmpfile(3) for non-USG systems.  */
@@ -307,7 +291,7 @@
 | characters.  If OBS is NULL, rather output the text to an external file  |
 | or an in-memory diversion buffer.  If OBS is NULL, and there is no      |
 | output file, the text is discarded.                                     |
-|                                                                         |
+|                                                                         |
 | If we are generating sync lines, the output have to be examined, because |
 | we need to know how much output each input line generates.  In general,  |
 | sync lines are output whenever a single input lines generates several
           |






reply via email to

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