bug-coreutils
[Top][All Lists]
Advanced

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

Re: I: coreutils-20041123: src/touch.c regression


From: Paul Eggert
Subject: Re: I: coreutils-20041123: src/touch.c regression
Date: Mon, 03 Jan 2005 00:53:58 -0800
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux)

"Dmitry V. Levin" <address@hidden> writes:

> Your change (at 2004-11-23) to src/touch.c introduces regression:
> On GNU/Linux without futimes syscall and without /proc mounted, futimes()
> function from glibc returns ENOENT, futimens() from gnulib also returns
> ENOENT, and touch utility fails.
> I suggest to modify gnulib's futimens() to fall back to utimes()
> when futimes() fails this way.

Thanks for reporting that; I installed this patch.  Could you please
give it a try?  My GNU/Linux distribution doesn't have this problem.
Thanks.

2005-01-03  Paul Eggert  <address@hidden>

        * utimens.c (futimens) [HAVE_FUTIMES]: Fall back on utimes if
        futimes fails with errno == ENOENT.  Problem reported by
        Dmitry V. Levin.

--- utimens.c   23 Nov 2004 20:42:13 -0000      1.3
+++ utimens.c   3 Jan 2005 08:51:59 -0000       1.4
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 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
@@ -24,6 +24,8 @@
 
 #include "utimens.h"
 
+#include <errno.h>
+
 #if HAVE_UTIME_H
 # include <utime.h>
 #endif
@@ -74,7 +76,16 @@ futimens (int fd ATTRIBUTE_UNUSED,
     t = NULL;
 # if HAVE_FUTIMES
   if (0 <= fd)
-    return futimes (fd, t);
+    {
+      if (futimes (fd, t) == 0)
+       return 0;
+
+      /* On GNU/Linux without the futimes syscall and without /proc
+        mounted, glibc futimes fails with errno == ENOENT.  Fall back
+        on utimes in this case.  */
+      if (errno != ENOENT)
+       return -1;
+    }
 # endif
   return utimes (file, t);
 




reply via email to

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