Alexander Kahl <[EMAIL PROTECTED]> wrote:
> gcc -std=gnu99  -I.      -march=pentium4 -O2 -pipe -fomit-frame-pointer -s 
> -fgnu89-inline -c utimecmp.c
> In file included from utimecmp.c:33:
> utimens.h:2: error: conflicting types for 'futimens'
> /tools/include/sys/stat.h:370: error: previous declaration of 'futimens' was 
> here
> make[2]: *** [utimecmp.o] Error 1
> make[2]: Leaving directory `/mnt/lfs/coreutils-build/coreutils/lib'
> make[1]: *** [all] Error 2
> make[1]: Leaving directory `/mnt/lfs/coreutils-build/coreutils/lib'
> make: *** [all-recursive] Error 1
>
> using newest glibc from cvs

Thanks for the reports.
The version of futimens used by coreutils (from gnulib)
takes both a file descriptor and a file name, for portability,
so that if your system doesn't support the FD-based functions
it can still do its job by falling back on the filename-based ones.

The first step is to rename the gnulib function (patch below), since
it is trying to do more than glibc's futimens.  Then, we can extend
the renamed gnulib function so that it uses glibc's futimens when possible.

For coreutils, the change is trivial:
  just s/futimens/gl_futimens/ in each of copy.c and touch.c.

I nearly changed it in gnulib, but since a few other projects (at least
gzip and tar) also use futimens, I'll wait for Paul to sign off.

2007-05-18  Jim Meyering  <[EMAIL PROTECTED]>

        * lib/utimens.c (gl_futimens): Rename from futimens,
        now that glibc-2.6 declares futimens.

Index: lib/utimens.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/utimens.c,v
retrieving revision 1.14
diff -u -p -r1.14 utimens.c
--- lib/utimens.c       18 Jan 2007 08:33:34 -0000      1.14
+++ lib/utimens.c       18 May 2007 07:42:56 -0000
@@ -75,8 +75,8 @@ struct utimbuf
    Return 0 on success, -1 (setting errno) on failure.  */

 int
-futimens (int fd ATTRIBUTE_UNUSED,
-         char const *file, struct timespec const timespec[2])
+gl_futimens (int fd ATTRIBUTE_UNUSED,
+            char const *file, struct timespec const timespec[2])
 {
   /* Some Linux-based NFS clients are buggy, and mishandle time stamps
      of files in NFS file systems in some cases.  We have no
@@ -185,5 +185,5 @@ futimens (int fd ATTRIBUTE_UNUSED,
 int
 utimens (char const *file, struct timespec const timespec[2])
 {
-  return futimens (-1, file, timespec);
+  return gl_futimens (-1, file, timespec);
 }


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to