Fix-use_smack-corrupt-cached-result
authorRonan Le Martret <ronan@fridu.net>
Fri, 18 Apr 2014 13:24:15 +0000 (15:24 +0200)
committerRonan Le Martret <ronan@fridu.net>
Fri, 18 Apr 2014 13:24:15 +0000 (15:24 +0200)
Change-Id: Id4666fe61980442e30cd5dd5b8d80517fb46157f

recipes-core/systemd/files/0001-Fix-use_smack-corrupt-cached-result.patch [new file with mode: 0644]
recipes-core/systemd/systemd_211.bbappend

diff --git a/recipes-core/systemd/files/0001-Fix-use_smack-corrupt-cached-result.patch b/recipes-core/systemd/files/0001-Fix-use_smack-corrupt-cached-result.patch
new file mode 100644 (file)
index 0000000..ce588a3
--- /dev/null
@@ -0,0 +1,45 @@
+From 82cd5f55a9cae6a5cd8ca82b2d386ac27fbc62d7 Mon Sep 17 00:00:00 2001
+From: Ronan Le Martret <ronan@fridu.net>
+Date: Fri, 18 Apr 2014 15:11:47 +0200
+Subject: [PATCH 1/1] Fix use_smack corrupt cached result.
+
+You can not put the cached result of use_smack fct,
+as we are not sure the "/sys" is mounted.
+So for the two first mount from mount_table,
+"/proc" and "/sys" result from use_smack should not be cached.
+
+Change-Id: I730b94a28bf6c5dd60d15dccc0409cd9e1a8a67c
+Signed-off-by: Ronan Le Martret <ronan@fridu.net>
+---
+ src/shared/smack-util.c | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
+index df194e0..db35be5 100644
+--- a/src/shared/smack-util.c
++++ b/src/shared/smack-util.c
+@@ -32,11 +32,16 @@
+ bool use_smack(void) {
+ #ifdef HAVE_SMACK
+         static int use_smack_cached = -1;
+-
+-        if (use_smack_cached < 0)
+-                use_smack_cached = access("/sys/fs/smackfs/", F_OK) >= 0;
+-
+-        return use_smack_cached;
++        int res = false;
++        if (use_smack_cached < 0) {
++                if (access("/sys/fs", F_OK) >= 0) {
++                        use_smack_cached = access("/sys/fs/smackfs/", F_OK) >= 0;
++                        res = use_smack_cached;
++                }
++        } else
++                res = use_smack_cached;
++
++        return res;
+ #else
+         return false;
+ #endif
+-- 
+1.8.1.4
+
index afd8cc6..b858f4f 100644 (file)
@@ -1,8 +1,10 @@
 FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
 
+SRC_URI += "file://0001-Fix-use_smack-corrupt-cached-result.patch"
+
 DEPENDS += "smack"
 RDEPENDS_${PN} += "smack"
 
 DEPENDS += "attr"
 
-EXTRA_OECONF +=  ' --enable-smack '
\ No newline at end of file
+EXTRA_OECONF +=  ' --enable-smack --with-smack-run-label=System '
\ No newline at end of file