mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
copy.c: factor out test for errno value indicating "unsupported"
* src/copy.c (errno_unsupported): New function. (copy_attr_error, copy_internal): Use it.
This commit is contained in:
1 parent
1fa226772c
commit
e0cf592f48
1 file changed
+8
-1
+8
-1
@@ -131,6 +131,12 @@ is_ancestor (const struct stat *sb, const struct dir_list *ancestors)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
errno_unsupported (int err)
|
||||||
|
{
|
||||||
|
return err == ENOTSUP || err == ENODATA;
|
||||||
|
}
|
||||||
|
|
||||||
#if USE_XATTR
|
#if USE_XATTR
|
||||||
static void
|
static void
|
||||||
copy_attr_error (struct error_context *ctx ATTRIBUTE_UNUSED,
|
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;
|
int err = errno;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (!errno_unsupported (errno))
|
||||||
if (errno != ENOTSUP && errno != ENODATA)
|
if (errno != ENOTSUP && errno != ENODATA)
|
||||||
{
|
{
|
||||||
/* use verror module to print error message */
|
/* use verror module to print error message */
|
||||||
@@ -1764,7 +1771,7 @@ copy_internal (char const *src_name, char const *dst_name,
|
|||||||
}
|
}
|
||||||
else
|
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)
|
if (!x->reduce_diagnostics || x->require_preserve_context)
|
||||||
error (0, errno,
|
error (0, errno,
|
||||||
|
|||||||
Reference in new issue
Block a user