* 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>
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.
/* 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
{
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
/* 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
/* 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
configure.ac:
gl_FUNC_MKOSTEMP
+gl_MODULE_INDICATOR([mkostemp])
gl_STDLIB_MODULE_INDICATOR([mkostemp])
Makefile.am:
configure.ac:
gl_FUNC_MKOSTEMPS
+gl_MODULE_INDICATOR([mkostemps])
gl_STDLIB_MODULE_INDICATOR([mkostemps])
Makefile.am:
configure.ac:
gl_FUNC_MKSTEMPS
+gl_MODULE_INDICATOR([mkstemps])
gl_STDLIB_MODULE_INDICATOR([mkstemps])
Makefile.am: