bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] utimens: remove invalid futimesat call


From: Jim Meyering
Subject: [PATCH] utimens: remove invalid futimesat call
Date: Sun, 08 Nov 2009 15:21:14 +0100

This fixes coreutils' final FreeBSD-8.0-rc2 test failure:

>From 26c5fd742f9136e2ddbd4695a9172c3fa30ea260 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 8 Nov 2009 12:09:35 +0100
Subject: [PATCH] utimens: remove invalid futimesat call

* lib/utimens.c (fdutimens) [HAVE_FUTIMESAT]: Remove invalid futimesat
call.  It used the file descriptor of the target file as the DIR_FD
parameter and NULL as the file name.  That caused failure with
errno == EFAULT on FreeBSD-8.0-rc2.
---
 ChangeLog     |    8 ++++++++
 lib/utimens.c |   11 ++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index c9d05ad..4c29111 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-11-08  Jim Meyering  <address@hidden>
+
+       utimens: remove invalid futimesat call
+       * lib/utimens.c (fdutimens): Remove invalid futimesat call.
+       It used the file descriptor of the target file as the DIR_FD
+       parameter and NULL as the file name.  That caused failure with
+       errno == EFAULT on FreeBSD-8.0-rc2
+
 2009-11-07  Eric Blake  <address@hidden>

        fflush, freadseek: use fseeko, not fseek
diff --git a/lib/utimens.c b/lib/utimens.c
index ce759a1..bd482d7 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -280,9 +280,9 @@ fdutimens (char const *file, int fd, struct timespec const 
timespec[2])
       }
     else
       {
-        /* If futimesat or futimes fails here, don't try to speed things
-           up by returning right away.  glibc can incorrectly fail with
-           errno == ENOENT if /proc isn't mounted.  Also, Mandrake 10.0
+        /* If futimesat (above) or futimes fails here, don't try to speed
+           things up by returning right away.  glibc can incorrectly fail
+           with errno == ENOENT if /proc isn't mounted.  Also, Mandrake 10.0
            in high security mode doesn't allow ordinary users to read
            /proc/self, so glibc incorrectly fails with errno == EACCES.
            If errno == EIO, EPERM, or EROFS, it's probably safe to fail
@@ -290,10 +290,7 @@ fdutimens (char const *file, int fd, struct timespec const 
timespec[2])
            worth optimizing, and who knows what other messed-up systems
            are out there?  So play it safe and fall back on the code
            below.  */
-# if HAVE_FUTIMESAT
-        if (futimesat (fd, NULL, t) == 0)
-          return 0;
-# elif HAVE_FUTIMES
+# if HAVE_FUTIMES
         if (futimes (fd, t) == 0)
           return 0;
 # endif
--
1.6.5.2.342.g27b86




reply via email to

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