diff options
author | Nathan Scott <nathans@sgi.com> | 2005-06-07 03:53:01 +0000 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-06-07 03:53:01 +0000 |
commit | 3c39672164e2de512b7015e8798a55332e4595c9 (patch) | |
tree | ba46af3daaf0d11401707e78a95f77d64743c8dd /libattr | |
parent | 925ee348492bcd7496ad0ff4ea60fe2e54c35c8d (diff) | |
download | attr-3c39672164e2de512b7015e8798a55332e4595c9.tar.gz |
Reduce verbosity when copying attributes between files.
Merge of master-melb:xfs-cmds:22833a by kenmcd.
Diffstat (limited to 'libattr')
-rw-r--r-- | libattr/attr_copy_fd.c | 42 | ||||
-rw-r--r-- | libattr/attr_copy_file.c | 42 |
2 files changed, 54 insertions, 30 deletions
diff --git a/libattr/attr_copy_fd.c b/libattr/attr_copy_fd.c index 6b9a0d7..17b87d8 100644 --- a/libattr/attr_copy_fd.c +++ b/libattr/attr_copy_fd.c @@ -69,6 +69,7 @@ attr_copy_fd(const char *src_path, int src_fd, int ret = 0; ssize_t size; char *names = NULL, *end_names, *name, *value = NULL; + unsigned int setxattr_ENOTSUP = 0; /* ignore acls by default */ if (check == NULL) @@ -137,24 +138,35 @@ attr_copy_fd(const char *src_path, int src_fd, quote_free (ctx, qpath); ret = -1; } - if (fsetxattr (dst_fd, name, value, size, 0) != 0) - { - const char *qpath = quote (ctx, dst_path); - if (errno == ENOSYS) { - error (ctx, _("setting attributes for %s"), - qpath); - ret = -1; - break; /* no hope of getting any further */ - } else { - const char *qname = quote (ctx, name); - error (ctx, _("setting attribute %s for %s"), - qname, qpath); - quote_free (ctx, qname); - ret = -1; + if (fsetxattr (dst_fd, name, value, size, 0) != 0) { + if (errno == ENOTSUP) + setxattr_ENOTSUP++; + else { + const char *qpath = quote (ctx, dst_path); + + if (errno == ENOSYS) { + error (ctx, _("setting attributes for " + "%s"), qpath); + ret = -1; + break; /* no hope of getting any further */ + } else { + const char *qname = quote (ctx, name); + error (ctx, _("setting attribute %s for %s"), + qname, qpath); + quote_free (ctx, qname); + ret = -1; + } + quote_free (ctx, qpath); } - quote_free (ctx, qpath); } } + if (setxattr_ENOTSUP) { + const char *qpath = quote (ctx, dst_path); + errno = ENOTSUP; + error (ctx, _("setting attributes for %s"), qpath); + ret = -1; + quote_free (ctx, qpath); + } getout: free (value); my_free (names); diff --git a/libattr/attr_copy_file.c b/libattr/attr_copy_file.c index 2b93276..b137678 100644 --- a/libattr/attr_copy_file.c +++ b/libattr/attr_copy_file.c @@ -67,6 +67,7 @@ attr_copy_file(const char *src_path, const char *dst_path, int ret = 0; ssize_t size; char *names = NULL, *end_names, *name, *value = NULL; + unsigned int setxattr_ENOTSUP = 0; /* ignore acls by default */ if (check == NULL) @@ -135,24 +136,35 @@ attr_copy_file(const char *src_path, const char *dst_path, quote_free (ctx, qpath); ret = -1; } - if (lsetxattr (dst_path, name, value, size, 0) != 0) - { - const char *qpath = quote (ctx, dst_path); - if (errno == ENOSYS) { - error (ctx, _("setting attributes for %s"), - qpath); - ret = -1; - break; /* no hope of getting any further */ - } else { - const char *qname = quote (ctx, name); - error (ctx, _("setting attribute %s for %s"), - qname, qpath); - quote_free (ctx, qname); - ret = -1; + if (lsetxattr (dst_path, name, value, size, 0) != 0) { + if (errno == ENOTSUP) + setxattr_ENOTSUP++; + else { + const char *qpath = quote (ctx, dst_path); + if (errno == ENOSYS) { + error (ctx, _("setting attributes for " + "%s"), qpath); + ret = -1; + /* no hope of getting any further */ + break; + } else { + const char *qname = quote (ctx, name); + error (ctx, _("setting attribute %s for" + "%s"), qname, qpath); + quote_free (ctx, qname); + ret = -1; + } + quote_free (ctx, qpath); } - quote_free (ctx, qpath); } } + if (setxattr_ENOTSUP) { + const char *qpath = quote (ctx, dst_path); + errno = ENOTSUP; + error (ctx, _("setting attributes for %s"), qpath); + ret = -1; + quote_free (ctx, qpath); + } getout: free (value); my_free (names); |