summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-03 14:49:29 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-10-03 14:49:29 +0200
commit7744e869ecbfd2a508dbba46acfc2133a2f8f840 (patch)
treed8052926e17c1048cd8a302a9b4cebbaef3c945d
parent22c89d3fd78d7ef3f231fc837a47860efcc4cc9e (diff)
move selinux noops to udev.h
-rw-r--r--TODO2
-rw-r--r--extras/floppy/Makefile.am5
-rw-r--r--udev/Makefile.am3
-rw-r--r--udev/udev.h8
-rw-r--r--udev/udev_selinux.c11
5 files changed, 14 insertions, 15 deletions
diff --git a/TODO b/TODO
index ac996f4012..f960f2431b 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
- add DEVTYPE
-
o handle spaces in SYMLINK+=, do not create multiple links
o use libudev device in udev_rules.c
get rid of udevice, store rule matching state in rule iterator
diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am
index 337e7a325c..357129e336 100644
--- a/extras/floppy/Makefile.am
+++ b/extras/floppy/Makefile.am
@@ -9,10 +9,11 @@ create_floppy_devices_SOURCES = \
../../udev/lib/libudev.h \
../../udev/lib/libudev.c \
../../udev/lib/libudev-util.c \
- ../../udev/udev_utils.c \
- ../../udev/udev_selinux.c
+ ../../udev/udev_utils.c
if USE_SELINUX
+create_floppy_devices_SOURCES += \
+ ../../udev/udev_selinux.c
create_floppy_devices_LDADD = \
$(SELINUX_LIBS)
endif
diff --git a/udev/Makefile.am b/udev/Makefile.am
index b9e2e89620..c0df391d6f 100644
--- a/udev/Makefile.am
+++ b/udev/Makefile.am
@@ -25,7 +25,6 @@ common_files = \
udev_sysfs.c \
udev_utils.c \
udev_utils_file.c \
- udev_selinux.c \
list.h \
lib/libudev.h \
lib/libudev-private.h \
@@ -39,6 +38,8 @@ common_files = \
lib/libudev-ctrl.c
if USE_SELINUX
+common_files += \
+ udev_selinux.c
common_ldadd += \
$(SELINUX_LIBS)
endif
diff --git a/udev/udev.h b/udev/udev.h
index b54d313bff..6a685e6758 100644
--- a/udev/udev.h
+++ b/udev/udev.h
@@ -168,11 +168,19 @@ extern void file_unmap(void *buf, size_t bufsize);
extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
/* udev_selinux */
+#ifndef USE_SELINUX
+static inline void selinux_init(struct udev *udev) {}
+static inline void selinux_exit(struct udev *udev) {}
+static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
+static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
+static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
+#else
extern void selinux_init(struct udev *udev);
extern void selinux_exit(struct udev *udev);
extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
extern void udev_selinux_resetfscreatecon(struct udev *udev);
+#endif
/* udevadm commands */
extern int udevadm_monitor(struct udev *udev, int argc, char *argv[]);
diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c
index 499f53c916..cf7f43496a 100644
--- a/udev/udev_selinux.c
+++ b/udev/udev_selinux.c
@@ -22,18 +22,10 @@
#include <stddef.h>
#include <stdarg.h>
#include <unistd.h>
+#include <selinux/selinux.h>
#include "udev.h"
-#ifndef USE_SELINUX
-void selinux_init(struct udev *udev) {}
-void selinux_exit(struct udev *udev) {}
-void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
-void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
-void udev_selinux_resetfscreatecon(struct udev *udev) {}
-#else
-#include <selinux/selinux.h>
-
static int selinux_enabled;
security_context_t selinux_prev_scontext;
@@ -96,4 +88,3 @@ void udev_selinux_resetfscreatecon(struct udev *udev)
if (setfscreatecon(selinux_prev_scontext) < 0)
err(udev, "setfscreatecon failed: %m\n");
}
-#endif