]> Savannah Git Hosting - gnulib.git/commitdiff
Avoid endless recursions if config.h includes some header files.
authorBruno Haible <bruno@clisp.org>
Tue, 30 Aug 2011 07:57:33 +0000 (09:57 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 30 Aug 2011 07:57:33 +0000 (09:57 +0200)
* lib/fopen.c (__need_FILE): Define already before including config.h.
* lib/freopen.c (__need_FILE): Likewise.
* lib/open.c (__need_system_fcntl_h): Likewise.
* lib/stat.c (__need_system_sys_stat_h): Likewise.
* lib/lstat.c (__need_system_sys_stat_h): Likewise.
Reported by Michael Goffioul <michael.goffioul@gmail.com>.

ChangeLog
lib/fopen.c
lib/freopen.c
lib/lstat.c
lib/open.c
lib/stat.c

index aef20cd4ad7eee9e3639ca84c1405404291d8234..c7d961e081461c1b4a32ef136587f143a6e8df97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2011-08-30  Bruno Haible  <bruno@clisp.org>
+
+       Avoid endless recursions if config.h includes some header files.
+       * lib/fopen.c (__need_FILE): Define already before including config.h.
+       * lib/freopen.c (__need_FILE): Likewise.
+       * lib/open.c (__need_system_fcntl_h): Likewise.
+       * lib/stat.c (__need_system_sys_stat_h): Likewise.
+       * lib/lstat.c (__need_system_sys_stat_h): Likewise.
+       Reported by Michael Goffioul <michael.goffioul@gmail.com>.
+
 2011-08-25  Karl Berry  <karl@gnu.org>
 
        * config/srclist.txt (ylwrap): new try.
index 81c861724ec751a5b51ada8a7b6834c474ecd050..33412fbcea1f314097535830d942f218b1e5d059 100644 (file)
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
+/* If the user's config.h happens to include <stdio.h>, let it include only
+   the system's <stdio.h> here, so that orig_fopen doesn't recurse to
+   rpl_fopen.  */
+#define __need_FILE
 #include <config.h>
 
 /* Get the original definition of fopen.  It might be defined as a macro.  */
-#define __need_FILE
 #include <stdio.h>
 #undef __need_FILE
 
index 0decbafc91fadf7682b1c16cf2a999c3f0529607..c76336580d9fa6721645f3a7876fdf15f2b2bdc6 100644 (file)
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
+/* If the user's config.h happens to include <stdio.h>, let it include only
+   the system's <stdio.h> here, so that orig_freopen doesn't recurse to
+   rpl_freopen.  */
+#define __need_FILE
 #include <config.h>
 
 /* Get the original definition of freopen.  It might be defined as a macro.  */
-#define __need_FILE
 #include <stdio.h>
 #undef __need_FILE
 
index b26065ede28d786eb1579d4d7e96e6bbdb6b6013..29fc6d25f90a4d6a45a0b64c2e7571594a216da4 100644 (file)
 
 /* written by Jim Meyering */
 
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_lstat doesn't recurse to
+   rpl_lstat.  */
+#define __need_system_sys_stat_h
 #include <config.h>
 
 #if !HAVE_LSTAT
@@ -27,7 +31,6 @@ typedef int dummy;
 #else /* HAVE_LSTAT */
 
 /* Get the original definition of lstat.  It might be defined as a macro.  */
-# define __need_system_sys_stat_h
 # include <sys/types.h>
 # include <sys/stat.h>
 # undef __need_system_sys_stat_h
index e60b619949918b09ce72d90df693210dfa3e9b90..ffd3b8dedc54d82c6d171a8e6766093d0efc23a9 100644 (file)
 
 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
 
+/* If the user's config.h happens to include <fcntl.h>, let it include only
+   the system's <fcntl.h> here, so that orig_open doesn't recurse to
+   rpl_open.  */
+#define __need_system_fcntl_h
 #include <config.h>
 
 /* Get the original definition of open.  It might be defined as a macro.  */
-#define __need_system_fcntl_h
 #include <fcntl.h>
-#undef __need_system_fcntl_h
 #include <sys/types.h>
+#undef __need_system_fcntl_h
 
 static inline int
 orig_open (const char *filename, int flags, mode_t mode)
index f07370dd06b921d4fcf7d44337edf1dbd32b9670..6c354d1d35735e266251a91074520f41b637c1a8 100644 (file)
 
 /* written by Eric Blake */
 
+/* If the user's config.h happens to include <sys/stat.h>, let it include only
+   the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
+   rpl_stat.  */
+#define __need_system_sys_stat_h
 #include <config.h>
 
 /* Get the original definition of stat.  It might be defined as a macro.  */
-#define __need_system_sys_stat_h
 #include <sys/types.h>
 #include <sys/stat.h>
 #undef __need_system_sys_stat_h