]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
mv: ignore xattr-preservation failure when not supported by filesystem
authorOndřej Vašík <ovasik@redhat.com>
Fri, 17 Apr 2009 09:00:35 +0000 (11:00 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 27 Apr 2009 11:26:03 +0000 (13:26 +0200)
*src/copy.c: Do not warn about xattr-preservation failure when xattrs
are not supported and preservation of xattrs is not explicitly required.
Reported by Eric Sandeen in http://bugzilla.redhat.com/496142

NEWS
src/copy.c

diff --git a/NEWS b/NEWS
index 8cb17cc6222806cd8dc132bbe6d1f11a5a737479..c537432e3d9a955c4ecc1d47211b0d24c9aeed35 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,9 @@ GNU coreutils NEWS                                    -*- outline -*-
 
   ls -v and sort -V now order names like "#.b#" properly
 
+  mv: do not print diagnostics when failing to preserve xattr's on file
+  systems without xattr support.
+
 ** Changes in behavior
 
   shred, sort, shuf: now use an internal pseudorandom generator by default.
index c45224c8af0232972591d5fa5058ea33e3333f8c..d01f9b3650cfe6b2de4c8f26fb6df53ea1033ad8 100644 (file)
@@ -139,6 +139,22 @@ copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
   int err = errno;
   va_list ap;
 
+  if (errno != ENOTSUP && errno != ENODATA)
+    {
+      /* use verror module to print error message */
+      va_start (ap, fmt);
+      verror (0, err, fmt, ap);
+      va_end (ap);
+    }
+}
+
+static void
+copy_attr_allerror (struct error_context *ctx ATTRIBUTE_UNUSED,
+                char const *fmt, ...)
+{
+  int err = errno;
+  va_list ap;
+
   /* use verror module to print error message */
   va_start (ap, fmt);
   verror (0, err, fmt, ap);
@@ -163,7 +179,7 @@ copy_attr_by_fd (char const *src_path, int src_fd,
 {
   struct error_context ctx =
   {
-    .error = copy_attr_error,
+    .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error,
     .quote = copy_attr_quote,
     .quote_free = copy_attr_free
   };
@@ -177,7 +193,7 @@ copy_attr_by_name (char const *src_path, char const *dst_path,
 {
   struct error_context ctx =
   {
-    .error = copy_attr_error,
+    .error = x->require_preserve_xattr ? copy_attr_allerror : copy_attr_error,
     .quote = copy_attr_quote,
     .quote_free = copy_attr_free
   };