char *rules_path;
int log_priority;
#ifdef USE_SELINUX
+ int selinux_initialized;
int selinux_enabled;
security_context_t selinux_prev_scontext;
#endif
udev->selinux_prev_scontext = NULL;
}
}
+ udev->selinux_initialized = 1;
#endif
}
static void selinux_exit(struct udev *udev)
{
#ifdef USE_SELINUX
+ if (!udev->selinux_initialized)
+ return;
if (udev->selinux_enabled) {
freecon(udev->selinux_prev_scontext);
udev->selinux_prev_scontext = NULL;
void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode)
{
#ifdef USE_SELINUX
+ if (!udev->selinux_initialized)
+ selinux_init(udev);
if (udev->selinux_enabled) {
security_context_t scontext = NULL;
void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode)
{
#ifdef USE_SELINUX
+ if (!udev->selinux_initialized)
+ selinux_init(udev);
if (udev->selinux_enabled) {
security_context_t scontext = NULL;
void udev_selinux_resetfscreatecon(struct udev *udev)
{
#ifdef USE_SELINUX
+ if (!udev->selinux_initialized)
+ selinux_init(udev);
if (udev->selinux_enabled) {
if (setfscreatecon(udev->selinux_prev_scontext) < 0)
err(udev, "setfscreatecon failed: %s\n", strerror(errno));
if (udev->dev_path == NULL || udev->sys_path == NULL)
goto err;
- selinux_init(udev);
info(udev, "context %p created\n", udev);
info(udev, "log_priority=%d\n", udev->log_priority);
info(udev, "config_file='%s'\n", config_file);