diff options
author | William Roberts <william.c.roberts@intel.com> | 2015-07-23 02:07:01 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-23 02:07:01 +0000 |
commit | 09fbb9669af14fd9bb97234ec518f8ac91819368 (patch) | |
tree | b865b424c7c0e7a7bc82cd40a8b7c9610926daf9 | |
parent | dc022606befb80fd6c8a10312b79cedbc40dddab (diff) | |
parent | be86166f7e4f49cb0cb0c97a368377b4d781998a (diff) | |
download | libselinux-09fbb9669af14fd9bb97234ec518f8ac91819368.tar.gz |
am be86166f: restorecon: do not set security.restorecon_last on ramfs and tmpfs
* commit 'be86166f7e4f49cb0cb0c97a368377b4d781998a':
restorecon: do not set security.restorecon_last on ramfs and tmpfs
-rw-r--r-- | src/android.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/android.c b/src/android.c index 1b4496d..5608f19 100644 --- a/src/android.c +++ b/src/android.c @@ -29,6 +29,8 @@ #include "label_internal.h" #include <fnmatch.h> #include <limits.h> +#include <sys/vfs.h> +#include <linux/magic.h> /* * XXX Where should this configuration file be located? @@ -1226,6 +1228,7 @@ static int selinux_android_restorecon_common(const char* pathname_orig, bool issys; bool setrestoreconlast = true; struct stat sb; + struct statfs sfsb; FTS *fts; FTSENT *ftsent; char *pathname; @@ -1282,6 +1285,12 @@ static int selinux_android_restorecon_common(const char* pathname_orig, if (issys) setrestoreconlast = false; + /* Ignore files on in-memory filesystems */ + if (statfs(pathname, &sfsb) == 0) { + if (sfsb.f_type == RAMFS_MAGIC || sfsb.f_type == TMPFS_MAGIC) + 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) { |