From 3344b839df8fe2dd2b4a4f470225e4c407cf2faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 3 Oct 2017 10:41:51 +0200 Subject: build-sys: use #if Y instead of #ifdef Y everywhere The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2 --- src/basic/selinux-util.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/basic/selinux-util.c') diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index c7a04ad76..51b807b85 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -26,7 +26,7 @@ #include #include -#ifdef HAVE_SELINUX +#if HAVE_SELINUX #include #include #include @@ -40,7 +40,7 @@ #include "time-util.h" #include "util.h" -#ifdef HAVE_SELINUX +#if HAVE_SELINUX DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon); DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free); @@ -54,7 +54,7 @@ static struct selabel_handle *label_hnd = NULL; #endif bool mac_selinux_use(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (cached_use < 0) cached_use = is_selinux_enabled() > 0; @@ -65,7 +65,7 @@ bool mac_selinux_use(void) { } void mac_selinux_retest(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX cached_use = -1; #endif } @@ -73,7 +73,7 @@ void mac_selinux_retest(void) { int mac_selinux_init(void) { int r = 0; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX usec_t before_timestamp, after_timestamp; struct mallinfo before_mallinfo, after_mallinfo; @@ -110,7 +110,7 @@ int mac_selinux_init(void) { void mac_selinux_finish(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!label_hnd) return; @@ -121,7 +121,7 @@ void mac_selinux_finish(void) { int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX struct stat st; int r; @@ -170,7 +170,7 @@ int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) { #if 0 /// UNNEDED by elogind int mac_selinux_apply(const char *path, const char *label) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!mac_selinux_use()) return 0; @@ -189,7 +189,7 @@ int mac_selinux_apply(const char *path, const char *label) { int mac_selinux_get_create_label_from_exe(const char *exe, char **label) { int r = -EOPNOTSUPP; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *mycon = NULL, *fcon = NULL; security_class_t sclass; @@ -221,7 +221,7 @@ int mac_selinux_get_our_label(char **label) { assert(label); -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!mac_selinux_use()) return -EOPNOTSUPP; @@ -236,7 +236,7 @@ int mac_selinux_get_our_label(char **label) { int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label) { int r = -EOPNOTSUPP; -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *mycon = NULL, *peercon = NULL, *fcon = NULL; _cleanup_context_free_ context_t pcon = NULL, bcon = NULL; security_class_t sclass; @@ -297,7 +297,7 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char * char* mac_selinux_free(char *label) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!label) return NULL; @@ -314,7 +314,7 @@ char* mac_selinux_free(char *label) { int mac_selinux_create_file_prepare(const char *path, mode_t mode) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *filecon = NULL; int r; @@ -357,7 +357,7 @@ int mac_selinux_create_file_prepare(const char *path, mode_t mode) { void mac_selinux_create_file_clear(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX PROTECT_ERRNO; if (!mac_selinux_use()) @@ -370,7 +370,7 @@ void mac_selinux_create_file_clear(void) { #if 0 /// UNNEEDED by elogind int mac_selinux_create_socket_prepare(const char *label) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX if (!mac_selinux_use()) return 0; @@ -389,7 +389,7 @@ int mac_selinux_create_socket_prepare(const char *label) { void mac_selinux_create_socket_clear(void) { -#ifdef HAVE_SELINUX +#if HAVE_SELINUX PROTECT_ERRNO; if (!mac_selinux_use()) @@ -403,7 +403,7 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) { /* Binds a socket and label its file system object according to the SELinux policy */ -#ifdef HAVE_SELINUX +#if HAVE_SELINUX _cleanup_freecon_ char *fcon = NULL; const struct sockaddr_un *un; bool context_changed = false; -- cgit v1.2.3