SCCS-vsn: old/init/init.c 5.12
SCCS-vsn: sbin/init/init.c 5.12
-static char sccsid[] = "@(#)init.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c 5.12 (Berkeley) %G%";
#endif not lint
#include <signal.h>
#include <sys/types.h>
#endif not lint
#include <signal.h>
#include <sys/types.h>
#include <setjmp.h>
#include <sys/reboot.h>
#include <setjmp.h>
#include <sys/reboot.h>
#include <errno.h>
#include <sys/file.h>
#include <ttyent.h>
#include <sys/syslog.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/file.h>
#include <ttyent.h>
#include <sys/syslog.h>
#include <sys/stat.h>
-#define LINSIZ sizeof(wtmp.ut_line)
+struct utmp ut;
+#define LINSIZ sizeof(ut.ut_line)
#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
char minus[] = "-";
char runc[] = "/etc/rc";
char utmpf[] = "/etc/utmp";
char minus[] = "-";
char runc[] = "/etc/rc";
char utmpf[] = "/etc/utmp";
-char wtmpf[] = "/usr/adm/wtmp";
char ctty[] = "/dev/console";
char ctty[] = "/dev/console";
struct tab
{
char line[LINSIZ];
struct tab
{
char line[LINSIZ];
int mergflag;
char tty[20];
jmp_buf sjbuf, shutpass;
int mergflag;
char tty[20];
jmp_buf sjbuf, shutpass;
#endif
int howto, oldhowto;
#endif
int howto, oldhowto;
#if defined(vax) || defined(tahoe)
howto = r11;
#else
#if defined(vax) || defined(tahoe)
howto = r11;
#else
signal(SIGALRM, SIG_DFL);
for (i = 0; i < 10; i++)
close(i);
signal(SIGALRM, SIG_DFL);
for (i = 0; i < 10; i++)
close(i);
- f = open(wtmpf, O_WRONLY|O_APPEND);
- if (f >= 0) {
- SCPYN(wtmp.ut_line, "~");
- SCPYN(wtmp.ut_name, "shutdown");
- SCPYN(wtmp.ut_host, "");
- time(&wtmp.ut_time);
- write(f, (char *)&wtmp, sizeof(wtmp));
- close(f);
- }
- return (1);
+ logwtmp("~", "shutdown", "");
}
single()
{
register pid;
register xpid;
}
single()
{
register pid;
register xpid;
;
if (status)
return (0);
;
if (status)
return (0);
- f = open(wtmpf, O_WRONLY|O_APPEND);
- if (f >= 0) {
- SCPYN(wtmp.ut_line, "~");
- SCPYN(wtmp.ut_name, "reboot");
- SCPYN(wtmp.ut_host, "");
- if (time0) {
- wtmp.ut_time = time0;
- time0 = 0;
- } else
- time(&wtmp.ut_time);
- write(f, (char *)&wtmp, sizeof(wtmp));
- close(f);
- }
+ logwtmp("~", "reboot", "");
-static char sccsid[] = "@(#)init.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)init.c 5.12 (Berkeley) %G%";
#endif not lint
#include <signal.h>
#include <sys/types.h>
#endif not lint
#include <signal.h>
#include <sys/types.h>
#include <setjmp.h>
#include <sys/reboot.h>
#include <setjmp.h>
#include <sys/reboot.h>
#include <errno.h>
#include <sys/file.h>
#include <ttyent.h>
#include <sys/syslog.h>
#include <sys/stat.h>
#include <errno.h>
#include <sys/file.h>
#include <ttyent.h>
#include <sys/syslog.h>
#include <sys/stat.h>
-#define LINSIZ sizeof(wtmp.ut_line)
+struct utmp ut;
+#define LINSIZ sizeof(ut.ut_line)
#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
#define CMDSIZ 200 /* max string length for getty or window command*/
#define ALL p = itab; p ; p = p->next
#define EVER ;;
char minus[] = "-";
char runc[] = "/etc/rc";
char utmpf[] = "/etc/utmp";
char minus[] = "-";
char runc[] = "/etc/rc";
char utmpf[] = "/etc/utmp";
-char wtmpf[] = "/usr/adm/wtmp";
char ctty[] = "/dev/console";
char ctty[] = "/dev/console";
struct tab
{
char line[LINSIZ];
struct tab
{
char line[LINSIZ];
int mergflag;
char tty[20];
jmp_buf sjbuf, shutpass;
int mergflag;
char tty[20];
jmp_buf sjbuf, shutpass;
#endif
int howto, oldhowto;
#endif
int howto, oldhowto;
#if defined(vax) || defined(tahoe)
howto = r11;
#else
#if defined(vax) || defined(tahoe)
howto = r11;
#else
signal(SIGALRM, SIG_DFL);
for (i = 0; i < 10; i++)
close(i);
signal(SIGALRM, SIG_DFL);
for (i = 0; i < 10; i++)
close(i);
- f = open(wtmpf, O_WRONLY|O_APPEND);
- if (f >= 0) {
- SCPYN(wtmp.ut_line, "~");
- SCPYN(wtmp.ut_name, "shutdown");
- SCPYN(wtmp.ut_host, "");
- time(&wtmp.ut_time);
- write(f, (char *)&wtmp, sizeof(wtmp));
- close(f);
- }
- return (1);
+ logwtmp("~", "shutdown", "");
}
single()
{
register pid;
register xpid;
}
single()
{
register pid;
register xpid;
;
if (status)
return (0);
;
if (status)
return (0);
- f = open(wtmpf, O_WRONLY|O_APPEND);
- if (f >= 0) {
- SCPYN(wtmp.ut_line, "~");
- SCPYN(wtmp.ut_name, "reboot");
- SCPYN(wtmp.ut_host, "");
- if (time0) {
- wtmp.ut_time = time0;
- time0 = 0;
- } else
- time(&wtmp.ut_time);
- write(f, (char *)&wtmp, sizeof(wtmp));
- close(f);
- }
+ logwtmp("~", "reboot", "");