diff options
| author | Stephen Smalley <sds@tycho.nsa.gov> | 2012-06-11 13:37:39 -0400 |
|---|---|---|
| committer | Stephen Smalley <sds@tycho.nsa.gov> | 2012-07-26 09:01:22 -0400 |
| commit | e096e36e50b4b66638ebc4d3c09c2ee35f538dfa (patch) | |
| tree | 123267105adaed0ea034773eeb4d663bc401ec5f /init/devices.c | |
| parent | ff856a2b927aaadb189181d2cd9dd08dc98456a4 (diff) | |
| download | system_core-e096e36e50b4b66638ebc4d3c09c2ee35f538dfa.tar.gz system_core-e096e36e50b4b66638ebc4d3c09c2ee35f538dfa.tar.bz2 system_core-e096e36e50b4b66638ebc4d3c09c2ee35f538dfa.zip | |
Set the SELinux security label on new directories.
Automatically set the SELinux security label on directories created
by init.rc. This avoids the need to separately call restorecon on
each such directory from the init.rc file. Also restorecon /dev
and /dev/socket after initial policy load so that they are labeled
correctly before any other dev nodes or sockets are created.
Change-Id: If6af6c4887cdead949737cebdd673957e9273ead
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Diffstat (limited to 'init/devices.c')
| -rw-r--r-- | init/devices.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/init/devices.c b/init/devices.c index 3b4d369d..1394351d 100644 --- a/init/devices.c +++ b/init/devices.c @@ -52,7 +52,7 @@ #define FIRMWARE_DIR2 "/vendor/firmware" #ifdef HAVE_SELINUX -static struct selabel_handle *sehandle; +extern struct selabel_handle *sehandle; #endif static int device_fd = -1; @@ -219,32 +219,6 @@ static void make_device(const char *path, #endif } - -static int make_dir(const char *path, mode_t mode) -{ - int rc; - -#ifdef HAVE_SELINUX - char *secontext = NULL; - - if (sehandle) { - selabel_lookup(sehandle, &secontext, path, mode); - setfscreatecon(secontext); - } -#endif - - rc = mkdir(path, mode); - -#ifdef HAVE_SELINUX - if (secontext) { - freecon(secontext); - setfscreatecon(NULL); - } -#endif - return rc; -} - - static void add_platform_device(const char *name) { int name_len = strlen(name); |
