summaryrefslogtreecommitdiff
path: root/src/copy.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-04-27 11:35:50 +0200
committerJim Meyering <meyering@redhat.com>2009-04-27 13:33:47 +0200
commite0cf592f48b4e67dc31d0482ae4f4dbc820e883e (patch)
treee3f24aa9ae8191d1e210b629d9380a3f0e10519f /src/copy.c
parent1fa226772cb25c9b2bc17480ddb30bb3dd569951 (diff)
downloadcoreutils-e0cf592f48b4e67dc31d0482ae4f4dbc820e883e.tar.xz
copy.c: factor out test for errno value indicating "unsupported"
* src/copy.c (errno_unsupported): New function. (copy_attr_error, copy_internal): Use it.
Diffstat (limited to 'src/copy.c')
-rw-r--r--src/copy.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/copy.c b/src/copy.c
index 1687b72c2..511f70500 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -131,6 +131,12 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
return false;
}
+static bool
+errno_unsupported (int err)
+{
+ return err == ENOTSUP || err == ENODATA;
+}
+
#if USE_XATTR
static void
copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
@@ -139,6 +145,7 @@ copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
int err = errno;
va_list ap;
+ if (!errno_unsupported (errno))
if (errno != ENOTSUP && errno != ENODATA)
{
/* use verror module to print error message */
@@ -1764,7 +1771,7 @@ copy_internal (char const *src_name, char const *dst_name,
}
else
{
- if ((errno != ENOTSUP && errno != ENODATA) || x->require_preserve_context)
+ if (!errno_unsupported (errno) || x->require_preserve_context)
{
if (!x->reduce_diagnostics || x->require_preserve_context)
error (0, errno,