bug-gnulib
[Top][All Lists]
Advanced

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

mkstemp-safer.c must include <config.h>


From: Jim Meyering
Subject: mkstemp-safer.c must include <config.h>
Date: Mon, 14 Nov 2005 08:50:41 +0100

I found this bug by inspection.
The problem is that on systems for which m4/mkstemp.c
would normally make an application use the replacement
function, an application calling mkstemp_safer would end up
using the buggy version, because mkstemp-safer.c didn't
include <config.h> (for the mkstemp -> mkstemp_rpl definition).

In coreutils I added a pre-release check target
to ensure that this sort of thing doesn't happen again.
We need something similar for gnulib.
See below for more detail.

2005-11-14  Jim Meyering  <address@hidden>

        * mkstemp-safer.c: Include <config.h>, required for possible
        replacement of mkstemp.

Index: lib/mkstemp-safer.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/mkstemp-safer.c,v
retrieving revision 1.1
diff -u -p -r1.1 mkstemp-safer.c
--- lib/mkstemp-safer.c 27 Aug 2005 20:46:51 -0000      1.1
+++ lib/mkstemp-safer.c 14 Nov 2005 07:36:39 -0000
@@ -18,6 +18,10 @@
 
 /* Written by Paul Eggert.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "stdlib-safer.h"
 
 #include <stdlib.h>

Here's the list of coreutils/lib/*.c exceptions
(i.e., files that are currently allowed *not* to include <config.h>)

lib/bcopy.c
lib/c-strtold.c
lib/fnmatch_loop.c
lib/full-read.c
lib/imaxtostr.c
lib/mempcpy.c
lib/memset.c
lib/offtostr.c
lib/regcomp.c
lib/regex_internal.c
lib/regexec.c
lib/safe-write.c
lib/strtoll.c
lib/strtoul.c
lib/strtoull.c
lib/strtoumax.c
lib/umaxtostr.c
lib/xstrtoul.c

Several of these are legitimate exceptions, e.g., for the 3-5-line
files that merely include some other .c file which *does* include
<config.h>.  But others I've just grandfathered in.
Of course, the list of affected files in gnulib is longer.
Run this: grep -L 'include <config.h>' lib/*.c




reply via email to

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