patch 9.0.2034: don't try to copy SMACK attribute, when none exist
Problem: don't try to copy SMACK attribute, when none exist
Solution: return early if SMACK extended attributes do not exist or
if they are not supported
closes: #1711
closes: #13348
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/os_unix.c b/src/os_unix.c
index 237171b..11448c5 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3047,6 +3047,11 @@
if (from_file == NULL)
return;
+ size = listxattr((char *)from_file, NULL, 0);
+ // not supported or no attributes to copy
+ if (errno == ENOTSUP || size == 0)
+ return;
+
for (index = 0 ; index < (int)(sizeof(smack_copied_attributes)
/ sizeof(smack_copied_attributes)[0]) ; index++)
{