Don't record runlvl transitions before we have a read-write /var. Noticed

by lrou at x dot ua.
This commit is contained in:
christos 2006-09-28 15:20:14 +00:00
parent d9590bcae9
commit 6bc6175052
1 changed files with 10 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: init.c,v 1.80 2006/09/25 19:42:04 christos Exp $ */
/* $NetBSD: init.c,v 1.81 2006/09/28 15:20:14 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n"
#if 0
static char sccsid[] = "@(#)init.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: init.c,v 1.80 2006/09/25 19:42:04 christos Exp $");
__RCSID("$NetBSD: init.c,v 1.81 2006/09/28 15:20:14 christos Exp $");
#endif
#endif /* not lint */
@ -1347,6 +1347,14 @@ utmpx_set_runlevel(char old, char new)
{
struct utmpx ut;
/*
* Don't record any transitions until we did the first transition
* to read ttys, which is when we are guaranteed to have a read-write
* /var. Perhaps use a different variable for this?
*/
if (sessions == NULL)
return;
(void)memset(&ut, 0, sizeof(ut));
(void)snprintf(ut.ut_line, sizeof(ut.ut_line), RUNLVL_MSG, new);
ut.ut_type = RUN_LVL;