summaryrefslogtreecommitdiff
path: root/src/update-utmp
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-03 10:41:51 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-04 12:09:29 +0200
commit349cc4a507c4d84fcadf61f42159ea6412717896 (patch)
tree8d6e64af681fb4e1e41a1fc01b4f225f56aa147d /src/update-utmp
parentaf8786b16a39fbc92818444aac156ccbb030018c (diff)
downloadsystemd-349cc4a507c4d84fcadf61f42159ea6412717896.tar.gz
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
Diffstat (limited to 'src/update-utmp')
-rw-r--r--src/update-utmp/update-utmp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c
index f68d60a134..29facfded0 100644
--- a/src/update-utmp/update-utmp.c
+++ b/src/update-utmp/update-utmp.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
@@ -42,7 +42,7 @@
typedef struct Context {
sd_bus *bus;
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
int audit_fd;
#endif
} Context;
@@ -125,7 +125,7 @@ static int on_reboot(Context *c) {
/* We finished start-up, so let's write the utmp
* record and send the audit msg */
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
@@ -154,7 +154,7 @@ static int on_shutdown(Context *c) {
/* We started shut-down, so let's write the utmp
* record and send the audit msg */
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
@@ -198,7 +198,7 @@ static int on_runlevel(Context *c) {
if (previous == runlevel)
return 0;
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c->audit_fd >= 0) {
_cleanup_free_ char *s = NULL;
@@ -223,7 +223,7 @@ static int on_runlevel(Context *c) {
int main(int argc, char *argv[]) {
Context c = {
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
.audit_fd = -1
#endif
};
@@ -245,7 +245,7 @@ int main(int argc, char *argv[]) {
umask(0022);
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
/* If the kernel lacks netlink or audit support,
* don't worry about it. */
c.audit_fd = audit_open();
@@ -275,7 +275,7 @@ int main(int argc, char *argv[]) {
log_debug("systemd-update-utmp stopped as pid "PID_FMT, getpid_cached());
finish:
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c.audit_fd >= 0)
audit_close(c.audit_fd);
#endif