]> Savannah Git Hosting - gnulib.git/commitdiff
utimens: remove dependency on dup2
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 19 Sep 2011 03:57:48 +0000 (20:57 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 19 Sep 2011 03:58:09 +0000 (20:58 -0700)
* lib/utimens.c (fdutimens): Don't invoke dup2; it's not needed
to work around the Linux kernel bug.
* modules/utimens (Depends-on): Remove dup2.

ChangeLog
lib/utimens.c
modules/utimens

index a2e395d4a07d62e9873fb1cb36d45409e0845d82..382b79ccbdff63e4ac4aaa6dae9b3da16b04fbb6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-09-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       utimens: remove dependency on dup2
+       * lib/utimens.c (fdutimens): Don't invoke dup2; it's not needed
+       to work around the Linux kernel bug.
+       * modules/utimens (Depends-on): Remove dup2.
+
 2011-09-18  Bruno Haible  <bruno@clisp.org>
 
        inet_ntop, inet_pton: Look for it also in libresolv.
index c19041140754714a6ddaa17dbad971d14f90d7d8..f7cb8def315cbe306d2c7db5ae0e1a040fae2af9 100644 (file)
@@ -180,18 +180,13 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
   if (adjustment_needed < 0)
     return -1;
 
-  /* Require that at least one of FD or FILE are valid.  Works around
+  /* Require that at least one of FD or FILE are potentially valid, to avoid
      a Linux bug where futimens (AT_FDCWD, NULL) changes "." rather
      than failing.  */
-  if (!file)
+  if (fd < 0 && !file)
     {
-      if (fd < 0)
-        {
-          errno = EBADF;
-          return -1;
-        }
-      if (dup2 (fd, fd) != fd)
-        return -1;
+      errno = EBADF;
+      return -1;
     }
 
   /* Some Linux-based NFS clients are buggy, and mishandle time stamps
index 1a9687f5797ff6ff261f34fc3e4826196930501f..c607608c0b492d7e90af9ab48fc31865f280e3a3 100644 (file)
@@ -9,7 +9,6 @@ m4/utimens.m4
 m4/utimes.m4
 
 Depends-on:
-dup2
 errno
 lstat
 gettime