summaryrefslogtreecommitdiff
path: root/lib/stat.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-08-30 09:57:33 +0200
committerBruno Haible <bruno@clisp.org>2011-08-30 09:57:33 +0200
commitc29a7464f1218da01129bea72cbfc3dcb524881a (patch)
tree49bc301a81c113a3a39a8aaac8a9d92162ae8a6a /lib/stat.c
parent84b1687bd51d4d47773a434ec12812292c4c0942 (diff)
downloadgnulib-c29a7464f1218da01129bea72cbfc3dcb524881a.tar.gz
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>.
Diffstat (limited to 'lib/stat.c')
-rw-r--r--lib/stat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/stat.c b/lib/stat.c
index f07370dd06..6c354d1d35 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -16,10 +16,13 @@
/* 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