From e30e6ad6c9cc0f150acc9d02c6eed02989cf8e8a Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 14 Feb 2021 04:35:26 +0100 Subject: [PATCH] plugins: bootmisc: skip UTMP/WTMP/BTMP on non-utmp systems (musl) Signed-off-by: Joachim Wiberg --- plugins/bootmisc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/bootmisc.c b/plugins/bootmisc.c index 1f6d3851..74f12ebe 100644 --- a/plugins/bootmisc.c +++ b/plugins/bootmisc.c @@ -144,10 +144,12 @@ static void setup(void *arg) /* * UTMP actually needs multiple db files */ - create("/var/run/utmp", 0644, 0, gid); /* Currently logged in */ - create("/var/log/wtmp", 0644, 0, gid); /* Login history */ - create("/var/log/btmp", 0600, 0, gid); /* Failed logins */ - create("/var/log/lastlog", 0644, 0, gid); + if (has_utmp()) { + create("/var/run/utmp", 0644, 0, gid); /* Currently logged in */ + create("/var/log/wtmp", 0644, 0, gid); /* Login history */ + create("/var/log/btmp", 0600, 0, gid); /* Failed logins */ + create("/var/log/lastlog", 0644, 0, gid); + } /* Set BOOT_TIME UTMP entry */ utmp_set_boot();