Fix smack rule copy at scratch box 31/63931/1 accepted/tizen/base/20160329.041711 submit/tizen_base/20160329.034516
authorDongHun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Mar 2016 00:58:57 +0000 (09:58 +0900)
committerDonghun Kwak <dh0128.kwak@samsung.com>
Tue, 29 Mar 2016 01:44:58 +0000 (18:44 -0700)
  - remove checking dest fd's smack rule.

Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Change-Id: I9dea3830c41f628d3a4cde469421e979817a3104

src/fs.h
src/smack.h

index 5ceea5b4962563eb7430055b8a7fc86a15daa61a..fa69c8a14549abefc41a2127ab45357e5342beb4 100644 (file)
--- a/src/fs.h
+++ b/src/fs.h
@@ -38,6 +38,7 @@
 # define S_MAGIC_RAMFS 0x858458f6
 # define S_MAGIC_SQUASHFS 0x73717368
 # define S_MAGIC_SYSFS 0x62656572
+# define S_MAGIC_SMACK 0x43415D53
 #elif defined __GNU__
 # include <hurd/hurd_types.h>
 #endif
index 731ce70e87a4e4b057632b32684edc9257a66bf8..cbc65e5d69b8bf75f89deaa26b0aa33b9ad2ef01 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/stat.h>
 #include <sys/xattr.h>
 #include <unistd.h>
+#include <errno.h>
 
 #define SMACK_PATHTEXTSIZE 80
 #define SMACK_LABELLEN 256
@@ -83,7 +84,11 @@ smack_of_file(const char *path, struct smack_attrs *result)
 
   i = lgetxattr(path, SMACK_ATTRNAME, result->attr, rlen);
   if (i < 0)
-    return i;
+  {
+      if ((errno == ENODATA) || (errno == ENOTSUP))
+        return 0;
+      return i;
+  }
 
   if (i < rlen)
     result->attr[i] = '\0';
@@ -145,7 +150,11 @@ smack_of_fd(int fd, struct smack_attrs *result)
 
   i = fgetxattr(fd, SMACK_ATTRNAME, result->attr, rlen);
   if (i < 0)
-    return i;
+  {
+      if ((errno == ENODATA) || (errno == ENOTSUP))
+        return 0;
+      return i;
+  }
 
   if (i < rlen)
     result->attr[i] = '\0';