bug-gnulib
[Top][All Lists]
Advanced

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

sys_stat: define lstat properly


From: Simon Josefsson
Subject: sys_stat: define lstat properly
Date: Mon, 27 Oct 2008 11:18:02 +0100
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

The lstat problem on mingw was because of the generated sys/stat.h
containing:

#if ! 0
# define lstat stat
#endif
#if 1 && 1
# undef lstat
# define lstat rpl_lstat
extern int rpl_lstat (const char *name, struct stat *buf);
#endif

That seems broken, and made lstat.c to call lstat, but there is no such
function under mingw.

The following patch fixes the lstat declaration in sys_stat.in.h.

Objections to pushing this?

/Simon

>From 9162dcc7c37cefc9853aadc44bd833313682c8ef Mon Sep 17 00:00:00 2001
From: Simon Josefsson <address@hidden>
Date: Mon, 27 Oct 2008 11:16:16 +0100
Subject: [PATCH] lib/sys_stat.in.h (lstat): Fix declaration for mingw.

---
 ChangeLog         |    4 ++++
 lib/sys_stat.in.h |   19 +++++++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6c0d79d..44600e6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-10-27  Simon Josefsson  <address@hidden>
 
+       * lib/sys_stat.in.h (lstat): Fix declaration for mingw.
+
+2008-10-27  Simon Josefsson  <address@hidden>
+
        * modules/lstat-tests: New module.
        * tests/test-lstat.c: New file.
 
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index aeca760..cb31f44 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -275,15 +275,22 @@
 # define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO)
 #endif
 
+#if @GNULIB_LSTAT@
+# if ! @HAVE_LSTAT@
 /* mingw does not support symlinks, therefore it does not have lstat.  But
    without links, stat does just fine.  */
-#if ! @HAVE_LSTAT@
-# define lstat stat
-#endif
-#if @GNULIB_LSTAT@ && @REPLACE_LSTAT@
-# undef lstat
-# define lstat rpl_lstat
+#  define lstat stat
+# elif @REPLACE_LSTAT@
+#  undef lstat
+#  define lstat rpl_lstat
 extern int rpl_lstat (const char *name, struct stat *buf);
+# endif
+#elif define GNULIB_POSIXCHECK
+# undef lstat
+# define lstat(p,b)                                                    \
+  (GL_LINK_WARNING ("lstat is unportable - "                           \
+                   "use gnulib module lstat for portability"),         \
+   lstat (p, b))
 #endif
 
 
-- 
1.5.6.5





reply via email to

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