diff --git a/src/utmp-api.c b/src/utmp-api.c index c315f0eb..a3051a45 100644 --- a/src/utmp-api.c +++ b/src/utmp-api.c @@ -127,6 +127,9 @@ void utmp_logrotate(void) NULL }; + if (!has_utmp()) + return 0; + for (i = 0; files[i]; i++) logrotate(files[i], MAX_NO, MAX_SZ); #endif /* LOGROTATE_ENABLED */ @@ -138,6 +141,9 @@ int utmp_set(int type, int pid, char *line, char *id, char *user) struct utmp ut; struct utsname uts; + if (!has_utmp()) + return 0; + switch (type) { case RUN_LVL: case BOOT_TIME: @@ -188,6 +194,9 @@ static int set_getty(int type, char *tty, char *id, char *user) { char *line; + if (!has_utmp()) + return 0; + if (!tty) line = ""; else if (!strncmp(tty, "/dev/", 5))