diff options
Diffstat (limited to 'src/rc')
-rw-r--r-- | src/rc/checkpath.c | 9 | ||||
-rw-r--r-- | src/rc/rc-selinux.h | 14 | ||||
-rw-r--r-- | src/rc/runscript.c | 5 |
3 files changed, 16 insertions, 12 deletions
diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c index 034cb4d2..3acb0406 100644 --- a/src/rc/checkpath.c +++ b/src/rc/checkpath.c @@ -45,10 +45,7 @@ #include "builtins.h" #include "einfo.h" #include "rc-misc.h" - -#ifdef HAVE_SELINUX #include "rc-selinux.h" -#endif typedef enum { inode_unknown = 0, @@ -164,8 +161,10 @@ static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode, } } +#ifdef HAVE_SELINUX if (selinux_on) selinux_util_label(path); +#endif return 0; } @@ -294,10 +293,8 @@ int checkpath(int argc, char **argv) if (gr) gid = gr->gr_gid; -#ifdef HAVE_SELINUX if (selinux_util_open() == 1) selinux_on = true; -#endif while (optind < argc) { if (writable) @@ -307,10 +304,8 @@ int checkpath(int argc, char **argv) optind++; } -#ifdef HAVE_SELINUX if (selinux_on) selinux_util_close(); -#endif return retval; } diff --git a/src/rc/rc-selinux.h b/src/rc/rc-selinux.h index e28f3339..039890b7 100644 --- a/src/rc/rc-selinux.h +++ b/src/rc/rc-selinux.h @@ -26,10 +26,24 @@ #ifndef RC_SELINUX_UTIL_H #define RC_SELINUX_UTIL_H +#ifdef HAVE_SELINUX + int selinux_util_open(void); int selinux_util_label(const char *path); int selinux_util_close(void); void selinux_setup(char **argv); +#else + +/* always return false for selinux_util_open() */ +#define selinux_util_open() (0) +#define selinux_util_label(x) do { } while(0) +#define selinux_util_close() do { } while(0) + +#define selinux_setup(x) do { } while(0) + +#endif + + #endif diff --git a/src/rc/runscript.c b/src/rc/runscript.c index 0ac19661..e59c6aed 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -66,10 +66,7 @@ #include "rc.h" #include "rc-misc.h" #include "rc-plugin.h" - -#ifdef HAVE_SELINUX #include "rc-selinux.h" -#endif #define PREFIX_LOCK RC_SVCDIR "/prefix.lock" @@ -1191,10 +1188,8 @@ openrc_run(int argc, char **argv) eprefix(prefix); } -#ifdef HAVE_SELINUX /* Ok, we are ready to go, so setup selinux if applicable */ selinux_setup(argv); -#endif deps = true; |