diff options
author | Stephen Smalley <sds@tycho.nsa.gov> | 2014-07-07 19:51:05 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-07-07 19:51:05 +0000 |
commit | 3946f9119bf4eadfcfb17bd15661515328cbbc86 (patch) | |
tree | 51a46dde77a644a71e555be19a005e30e7867619 | |
parent | a6e100d3f5457fd2307fd160c31c64272c110447 (diff) | |
parent | f8417037e919284b2b68be6e50e1f3784511f7f1 (diff) | |
download | libselinux-lollipop-dev.tar.gz |
am f8417037: am da4208c8: Do not try to set restorecon_last on /sys entries.android-cts-5.0_r9android-cts-5.0_r8android-cts-5.0_r7android-cts-5.0_r6android-cts-5.0_r5android-cts-5.0_r4android-cts-5.0_r3android-5.0.2_r3android-5.0.2_r1android-5.0.1_r1android-5.0.0_r7android-5.0.0_r6android-5.0.0_r5.1android-5.0.0_r5android-5.0.0_r4android-5.0.0_r3android-5.0.0_r2android-5.0.0_r1lollipop-releaselollipop-devlollipop-cts-release
* commit 'f8417037e919284b2b68be6e50e1f3784511f7f1':
Do not try to set restorecon_last on /sys entries.
-rw-r--r-- | src/android.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/android.c b/src/android.c index 74d777f..6eeefec 100644 --- a/src/android.c +++ b/src/android.c @@ -1174,6 +1174,9 @@ err: goto out; } +#define SYS_PATH "/sys" +#define SYS_PREFIX SYS_PATH "/" + static int selinux_android_restorecon_common(const char* pathname, const char *seinfo, uid_t uid, @@ -1184,7 +1187,7 @@ static int selinux_android_restorecon_common(const char* pathname, bool recurse = (flags & SELINUX_ANDROID_RESTORECON_RECURSE) ? true : false; bool force = (flags & SELINUX_ANDROID_RESTORECON_FORCE) ? true : false; bool datadata = (flags & SELINUX_ANDROID_RESTORECON_DATADATA) ? true : false; - bool issys = strcmp(pathname, "/sys") == 0 ? true : false; + bool issys = (!strcmp(pathname, SYS_PATH) || !strncmp(pathname, SYS_PREFIX, sizeof(SYS_PREFIX)-1)) ? true : false; bool setrestoreconlast = true; struct stat sb; FTS *fts; @@ -1220,6 +1223,10 @@ static int selinux_android_restorecon_common(const char* pathname, !strncmp(pathname, DATA_USER_PREFIX, sizeof(DATA_USER_PREFIX)-1)) setrestoreconlast = false; + /* Also ignore on /sys since it is regenerated on each boot regardless. */ + if (issys) + setrestoreconlast = false; + if (setrestoreconlast) { size = getxattr(pathname, RESTORECON_LAST, xattr_value, sizeof fc_digest); if (!force && size == sizeof fc_digest && memcmp(fc_digest, xattr_value, sizeof fc_digest) == 0) { |