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
This commit is contained in:
Ondřej Vašík
2009-04-17 11:00:35 +02:00
committed by Jim Meyering
parent 819ee4272b
commit 941bd48235
2 changed files with 21 additions and 2 deletions

3
NEWS
View File

@@ -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.

View 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
};