From 3c39672164e2de512b7015e8798a55332e4595c9 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Tue, 7 Jun 2005 03:53:01 +0000 Subject: Reduce verbosity when copying attributes between files. Merge of master-melb:xfs-cmds:22833a by kenmcd. --- VERSION | 4 ++-- debian/changelog | 4 ++-- doc/CHANGES | 5 +++++ libattr/attr_copy_fd.c | 42 +++++++++++++++++++++++++++--------------- libattr/attr_copy_file.c | 42 +++++++++++++++++++++++++++--------------- 5 files changed, 63 insertions(+), 34 deletions(-) diff --git a/VERSION b/VERSION index bf0975a..cd9fd28 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=4 -PKG_REVISION=22 -PKG_BUILD=1 +PKG_REVISION=23 +PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 38bd62f..ff92c3e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -attr (2.4.22-1) unstable; urgency=low +attr (2.4.23-1) unstable; urgency=low * New upstream release - -- Nathan Scott Mon, 21 Feb 2005 08:13:36 +1100 + -- Nathan Scott Tue, 07 Jun 2005 09:10:32 +1000 attr (2.4.21-1) unstable; urgency=low diff --git a/doc/CHANGES b/doc/CHANGES index fce03ed..6baea91 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,8 @@ +attr-2.4.23 (3 June 2005) + - attr_copy_{fd,file}: Reduce verboseness for ENOTSUP errors. + ENOTSUPP is common when copying between xattr enabled and + xattr disabled file systems. + attr-2.4.22 (21 February 2005) - Allocate the line buffer dynamically when reading from a file. This mainly fixes restoring of large attributes. 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); -- cgit v1.2.3