]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp: ignore obscure failure to preserve symlink time stamps,
authorJim Meyering <meyering@redhat.com>
Mon, 24 Aug 2009 06:21:47 +0000 (08:21 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 24 Aug 2009 10:44:13 +0000 (12:44 +0200)
...when run on a kernel older than what was implied by headers and
libraries tested at configure time.
* src/copy.c (utimens_symlink): Ignore failure when errno == ENOSYS.
* NEWS (Bug fixes): Mention it.
Reported by Todd Zullinger and Kamil Dudka.
Details in this thread:
http://thread.gmane.org/gmane.linux.redhat.fedora.devel/119834

NEWS
src/copy.c

diff --git a/NEWS b/NEWS
index 2c744b15d38ff111a2bbe923592283ae3d2dad04..c125b3194d9b4a8239e4c5d6a7a1593008404825 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,12 @@ GNU coreutils NEWS                                    -*- outline -*-
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** Bug fixes
+
+  cp, mv now ignore failure to preserve a symlink time stamp, when it is
+  due to their running on a kernel older than what was implied by headers
+  and libraries tested at configure time.
+
 
 * Noteworthy changes in release 7.5 (2009-08-20) [stable]
 
index bf9230bb044b6f06720a964a2c80c1412c43ff95..b5cf64c6a9112e972b0775a0336106f5847dd50f 100644 (file)
@@ -123,13 +123,18 @@ static char const *top_level_dst_name;
 static inline int
 utimens_symlink (char const *file, struct timespec const *timespec)
 {
+  int err = 0;
+
 #if HAVE_UTIMENSAT
-  return utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
-#else
-  /* Don't set errno=ENOTSUP here as we don't want
-     to output an error message for this case.  */
-  return 0;
+  err = utimensat (AT_FDCWD, file, timespec, AT_SYMLINK_NOFOLLOW);
+  /* When configuring on a system with new headers and libraries, and
+     running on one with a kernel that is old enough to lack the syscall,
+     utimensat fails with ENOSYS.  Ignore that.  */
+  if (err && errno == ENOSYS)
+    err = 0;
 #endif
+
+  return err;
 }
 
 /* Perform the O(1) btrfs clone operation, if possible.