From 87f6769c51f81ad0022d8f5735ba3071160a68af Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sun, 14 Feb 2021 03:58:48 +0100 Subject: [PATCH] Revert "Workaround for _PATH_UTMP and _PATH_WTMP defines on musl libc" This reverts commit 8a71f2d3239bbe1aa957097d7696aed75c5160d1 because if no other application has a working utmp then there's no poit for Finit to have one. Instead we'll be disabling all utmp support when running on a musl based system. Signed-off-by: Joachim Wiberg --- src/initctl.c | 2 +- src/utmp-api.c | 6 +++++- src/utmp-api.h | 18 ------------------ 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/src/initctl.c b/src/initctl.c index 36d7e2af..a9c5e70a 100644 --- a/src/initctl.c +++ b/src/initctl.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -39,7 +40,6 @@ #include "serv.h" #include "service.h" #include "util.h" -#include "utmp-api.h" #define _PATH_COND _PATH_VARRUN "finit/cond/" diff --git a/src/utmp-api.c b/src/utmp-api.c index ab9a09d0..c315f0eb 100644 --- a/src/utmp-api.c +++ b/src/utmp-api.c @@ -25,12 +25,16 @@ #include #include +#include #include #include #include #include "helpers.h" -#include "utmp-api.h" + +#ifndef _PATH_BTMP +#define _PATH_BTMP "/var/log/btmp" +#endif #define MAX_NO 5 #define MAX_SZ 100 * 1024 diff --git a/src/utmp-api.h b/src/utmp-api.h index 1f81b6fb..20f67cf7 100644 --- a/src/utmp-api.h +++ b/src/utmp-api.h @@ -24,24 +24,6 @@ #ifndef FINIT_UTMP_API_H_ #define FINIT_UTMP_API_H_ -#include - -/* - * musl libc default to /dev/null/utmp and /dev/null/wtmp, respectively. - * See https://www.openwall.com/lists/musl/2012/03/04/4 for reasoning. - * - * Also, there's no __MUSL__, so we cannot make a libc-specific check - * here to work around this, that's why everyone pays. - */ -#undef _PATH_UTMP -#undef _PATH_WTMP -#undef _PATH_BTMP - -#define _PATH_UTMP "/var/run/wtmp" -#define _PATH_WTMP "/var/log/wtmp" -#define _PATH_BTMP "/var/log/btmp" - - int utmp_set (int type, int pid, char *line, char *id, char *user); int utmp_set_boot (void); int utmp_set_halt (void);