diff options
author | Greg KH <greg@press.(none)> | 2005-04-26 23:48:29 -0700 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:48:29 -0700 |
commit | 7eb92135c61af77fff62eec5f396b9633a54b245 (patch) | |
tree | 323b33417ced8d1215851282ba736a8489856cd2 /udev_selinux.c | |
parent | 237415b141ae2f3915160bc43ed76296588299f0 (diff) |
more merge fixups, looks like i missed a selinux patch somewhere...
Diffstat (limited to 'udev_selinux.c')
-rw-r--r-- | udev_selinux.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/udev_selinux.c b/udev_selinux.c index cc6f4d7d3f..72381f0d0d 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -105,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode } if (setfilecon(file, scontext) < 0) - dbg("setfilecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfiles %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } @@ -131,20 +131,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int } if (setfscreatecon(scontext) < 0) - dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfiles %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } } -void selinux_resetfscreatecon(void) -{ - if (is_selinux_running()) { - if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); - } -} - void selinux_init(void) { /* @@ -152,17 +144,23 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { - if (getfscreatecon(&prev_scontext) < 0) { + if (getfscreatecon(&prev_scontext) < 0) dbg("getfscreatecon failed\n"); - prev_scontext = NULL; - } + + prev_scontext = NULL; } } -void selinux_exit(void) +void selinux_restore(void) { - if (is_selinux_running() && prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; + if (is_selinux_running()) { + /* reset the file create context to its former glory */ + if (setfscreatecon(prev_scontext) < 0) + dbg("setfscreatecon failed\n"); + + if (prev_scontext) { + freecon(prev_scontext); + prev_scontext = NULL; + } } } |