From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 7618A138CC5 for ; Wed, 25 Mar 2015 06:10:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D5257E0855; Wed, 25 Mar 2015 06:10:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6B228E0855 for ; Wed, 25 Mar 2015 06:10:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 73B953408CC for ; Wed, 25 Mar 2015 06:10:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6F022147C3 for ; Wed, 25 Mar 2015 06:10:12 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1427263298.a4cf61e8bf827dc405a547c314e840dab11fc979.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/checkpath.c src/rc/rc-selinux.h src/rc/runscript.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: a4cf61e8bf827dc405a547c314e840dab11fc979 X-VCS-Branch: master Date: Wed, 25 Mar 2015 06:10:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3d8bca56-8788-4239-b58b-936061b37a07 X-Archives-Hash: f02c253b5eb3124b5513ca5b115eb4cb commit: a4cf61e8bf827dc405a547c314e840dab11fc979 Author: William Hubbs gmail com> AuthorDate: Wed Mar 25 05:57:05 2015 +0000 Commit: William Hubbs gentoo org> CommitDate: Wed Mar 25 06:01:38 2015 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a4cf61e8 selinux: unconditionally include the header and provide stub methods If selinux is disabled, then stub methods will be provided instead of calling the real methods. This removes some warnings about unused parameters which used to be covered up with #ifdef HAVE_SELINUX. Signed-off-by: Jason Zaman perfinion.com> src/rc/checkpath.c | 9 ++------- src/rc/rc-selinux.h | 14 ++++++++++++++ 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 034cb4d..3acb040 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 e28f333..039890b 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 0ac1966..e59c6ae 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;