Skip UTMP/WTMP update on systems w/o support for it (musl)

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-02-14 04:17:39 +01:00
1 parent d9b705ab98
commit c1e4c24136
1 file changed
+9
+9
View File
@@ -127,6 +127,9 @@ void utmp_logrotate(void)
NULL NULL
}; };
if (!has_utmp())
return 0;
for (i = 0; files[i]; i++) for (i = 0; files[i]; i++)
logrotate(files[i], MAX_NO, MAX_SZ); logrotate(files[i], MAX_NO, MAX_SZ);
#endif /* LOGROTATE_ENABLED */ #endif /* LOGROTATE_ENABLED */
@@ -138,6 +141,9 @@ int utmp_set(int type, int pid, char *line, char *id, char *user)
struct utmp ut; struct utmp ut;
struct utsname uts; struct utsname uts;
if (!has_utmp())
return 0;
switch (type) { switch (type) {
case RUN_LVL: case RUN_LVL:
case BOOT_TIME: case BOOT_TIME:
@@ -188,6 +194,9 @@ static int set_getty(int type, char *tty, char *id, char *user)
{ {
char *line; char *line;
if (!has_utmp())
return 0;
if (!tty) if (!tty)
line = ""; line = "";
else if (!strncmp(tty, "/dev/", 5)) else if (!strncmp(tty, "/dev/", 5))