stdlib-safer: wrap all mkstemp variants
authorEric Blake <ebb9@byu.net>
Mon, 2 Nov 2009 23:11:18 +0000 (16:11 -0700)
committerEric Blake <ebb9@byu.net>
Thu, 5 Nov 2009 02:10:16 +0000 (19:10 -0700)
* modules/mkostemp (configure.ac): Set witness.
* modules/mkostemps (configure.ac): Likewise.
* modules/mkstemps (configure.ac): Likewise.
* lib/stdlib-safer.h (mkostemp_safer, mkostemps_safer)
(mkstemps_safer): Wrap more functions.
* lib/stdlib--.h (mkostemp, mkostemps, mkstemps): Default the
wrapping.
* lib/mkstemp-safer.c (mkostemp_safer, mkostemps_safer)
(mkstemps_safer): Implement the wrappers.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/mkstemp-safer.c
lib/stdlib--.h
lib/stdlib-safer.h
modules/mkostemp
modules/mkostemps
modules/mkstemps

index 34952e259a17d13aa69eb9342c2b3c1960f6a537..fdfd828a0c547123a034fb594d18e2c7c03095bb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-11-04  Eric Blake  <ebb9@byu.net>
 
+       stdlib-safer: wrap all mkstemp variants
+       * modules/mkostemp (configure.ac): Set witness.
+       * modules/mkostemps (configure.ac): Likewise.
+       * modules/mkstemps (configure.ac): Likewise.
+       * lib/stdlib-safer.h (mkostemp_safer, mkostemps_safer)
+       (mkstemps_safer): Wrap more functions.
+       * lib/stdlib--.h (mkostemp, mkostemps, mkstemps): Default the
+       wrapping.
+       * lib/mkstemp-safer.c (mkostemp_safer, mkostemps_safer)
+       (mkstemps_safer): Implement the wrappers.
+
        mkstemps, mkostemps: new modules
        * modules/mkostemps: New module.
        * modules/mkstemps: Likewise.
index 4ba97c3790c598df63c9cf143c389cf416820197..95d315b030bdacc62a3543c5e6f09c31289450a6 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke mkstemp, but avoid some glitches.
 
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -32,3 +32,32 @@ mkstemp_safer (char *templ)
 {
   return fd_safer (mkstemp (templ));
 }
+
+#if GNULIB_MKOSTEMP
+/* Like mkostemp, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+int
+mkostemp_safer (char *templ, int flags)
+{
+  return fd_safer (mkostemp (templ, flags));
+}
+#endif
+
+#if GNULIB_MKOSTEMPS
+/* Like mkostemps, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+int
+mkostemps_safer (char *templ, int suffixlen, int flags)
+{
+  return fd_safer (mkostemps (templ, suffixlen, flags));
+}
+#endif
+
+#if GNULIB_MKSTEMPS
+/* Like mkstemps, but do not return STDIN_FILENO, STDOUT_FILENO, or
+   STDERR_FILENO.  */
+int mkstemps_safer (char *templ, int suffixlen)
+{
+  return fd_safer (mkstemps (templ, suffixlen));
+}
+#endif
index 495d0eb8f5370d5386debbcdb38eace045de291f..91268c9206d2e2cf5dddcb8395cd5883849106f8 100644 (file)
@@ -1,6 +1,6 @@
 /* Like stdlib.h, but redefine some names to avoid glitches.
 
-   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #undef mkstemp
 #define mkstemp mkstemp_safer
+
+#if GNULIB_MKOSTEMP
+# define mkostemp mkostemp_safer
+#endif
+
+#if GNULIB_MKOSTEMPS
+# define mkostemps mkostemps_safer
+#endif
+
+#if GNULIB_MKSTEMPS
+# define mkstemps mkstemps_safer
+#endif
index a014372962125e1e76d6e7f790d463b0ed8b5ee8..c28897ca22fcb4e67bfe57ed35c20aea7d6dfa06 100644 (file)
@@ -1,6 +1,6 @@
 /* Invoke stdlib.h functions, but avoid some glitches.
 
-   Copyright (C) 2005 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2009 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 /* Written by Paul Eggert.  */
 
 int mkstemp_safer (char *);
+
+#if GNULIB_MKOSTEMP
+int mkostemp_safer (char *, int);
+#endif
+
+#if GNULIB_MKOSTEMPS
+int mkostemps_safer (char *, int, int);
+#endif
+
+#if GNULIB_MKSTEMPS
+int mkstemps_safer (char *, int);
+#endif
index e336b90626de0980e3596996c626d5b7ff0ee0a4..8a61dbeb076ff18e504ad335a650527741c56cee 100644 (file)
@@ -13,6 +13,7 @@ tempname
 
 configure.ac:
 gl_FUNC_MKOSTEMP
+gl_MODULE_INDICATOR([mkostemp])
 gl_STDLIB_MODULE_INDICATOR([mkostemp])
 
 Makefile.am:
index 54c55e67ba9b6e2de913d976e17dfc8fd2c65342..a4175bdb504432239b86647c6aec299712cc80de 100644 (file)
@@ -13,6 +13,7 @@ tempname
 
 configure.ac:
 gl_FUNC_MKOSTEMPS
+gl_MODULE_INDICATOR([mkostemps])
 gl_STDLIB_MODULE_INDICATOR([mkostemps])
 
 Makefile.am:
index 14f469858bb35b4f2d3deb6a0ed23ab288380407..2a497776748d87de96b7ec2128a91e93a48cfabe 100644 (file)
@@ -12,6 +12,7 @@ tempname
 
 configure.ac:
 gl_FUNC_MKSTEMPS
+gl_MODULE_INDICATOR([mkstemps])
 gl_STDLIB_MODULE_INDICATOR([mkstemps])
 
 Makefile.am: