OSDN Git Service

Fix warning: 'XATTR_NAME_SMACK' macro redefined.
authorElliott Hughes <enh@google.com>
Tue, 2 Aug 2016 18:12:15 +0000 (11:12 -0700)
committerRob Landley <rob@landley.net>
Tue, 2 Aug 2016 20:26:07 +0000 (15:26 -0500)
Recent Linux uapi <linux/xattr.h> headers define XATTR_NAME_SMACK.
The <sys/xattr.h> include at the top of lib/lsm.h means that even
though the direct include of <linux/xattr.h> is guarded, it may
have already happened transitively anyway.

(The alternative fixes would be to hard-code the correct value for
XATTR_NAME_SMACK here instead, or #undef XATTR_NAME_SMACK.)

lib/lsm.h

index 3a5b7eb..e21d424 100644 (file)
--- a/lib/lsm.h
+++ b/lib/lsm.h
@@ -23,7 +23,9 @@
 #include <sys/smack.h>
 #include <linux/xattr.h>
 #else
+#ifndef XATTR_NAME_SMACK
 #define XATTR_NAME_SMACK 0
+#endif
 //ssize_t fgetxattr (int fd, char *name, void *value, size_t size);
 #define smack_smackfs_path(...) (-1)
 #define smack_new_label_from_self(...) (-1)