bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] Re: [bug-gnulib] stat and lstat should define their rep


From: Bruno Haible
Subject: Re: [bug-gnulib] Re: [bug-gnulib] stat and lstat should define their replacements
Date: Wed, 25 May 2005 13:21:33 +0200
User-agent: KMail/1.5

Derek Price <address@hidden> writes:
> As near as I can tell, stat and lstat do not define names for their
> replacements as many of the other GNULIB modules do.

Yes. The 'stat' and 'lstat' modules look incomplete. I think this should
be added to make them usable out-of-the-box.

diff -c -3 -r1.20 lstat.m4
*** m4/lstat.m4 2 May 2005 07:00:50 -0000       1.20
--- m4/lstat.m4 25 May 2005 11:17:55 -0000
***************
*** 19,24 ****
--- 19,25 ----
  AC_DEFUN([gl_FUNC_LSTAT],
  [
    AC_REQUIRE([AC_FUNC_LSTAT])
+   AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
    dnl Note: AC_FUNC_LSTAT does AC_LIBOBJ(lstat).
    :
  ])
*** /dev/null   1970-01-01 01:00:00.000000000 +0100
--- lib/sys_stat.h      2005-05-25 13:16:45.000000000 +0200
***************
*** 0 ****
--- 1,37 ----
+ /* Retrieving information about files.
+    Copyright (C) 2005 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
+    the Free Software Foundation; either version 2, or (at your option)
+    any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software Foundation,
+    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+ 
+ #include <sys/stat.h>
+ 
+ /* gl_stat() is a fixed version of stat().
+    gl_lstat() is a fixed version of lstat().
+    We cannot offer a stat() and lstat() function because on some hosts,
+    a "#define stat stat64" and "#define lstat lstat64" is being used.  */
+ 
+ #if HAVE_STAT_EMPTY_STRING_BUG
+ extern int rpl_stat (const char *name, struct stat *buf);
+ # define gl_stat(name,buf) rpl_stat (name, buf)
+ #else
+ # define gl_stat(name,buf) stat (name, buf)
+ #endif
+ 
+ #if HAVE_LSTAT_EMPTY_STRING_BUG || !LSTAT_FOLLOWS_SLASHED_SYMLINK
+ extern int rpl_lstat (const char *name, struct stat *buf);
+ # define gl_lstat(name,buf) rpl_lstat (name, buf)
+ #else
+ # define gl_lstat(name,buf) lstat (name, buf)
+ #endif


Paul Eggert wrote:

> A big worry here is hosts that use something like "#define stat
> stat64" when compiled in large-file mode.

Yes. I've also seen this problem on Linux/x86 when a non-gcc compiler
(such as the Intel icc compiler) is used.

Bruno





reply via email to

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