summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Vašík <ovasik@redhat.com>2009-04-17 11:00:35 +0200
committerJim Meyering <meyering@redhat.com>2009-04-27 13:26:03 +0200
commit941bd48235cceceb4f1c072e06a4bedd14b5e0b5 (patch)
tree451b347a717451d8c520e08bd121888b5afd82cb
parent819ee4272b927877317699afd0c06c1f33935e04 (diff)
downloadcoreutils-941bd48235cceceb4f1c072e06a4bedd14b5e0b5.tar.xz
mv: ignore xattr-preservation failure when not supported by filesystem
*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
-rw-r--r--NEWS3
-rw-r--r--src/copy.c20
2 files changed, 21 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 8cb17cc62..c537432e3 100644
--- 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.
diff --git a/src/copy.c b/src/copy.c
index c45224c8a..d01f9b365 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -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
};