#include <utmp.h>
#include <ctype.h>
#include <stdarg.h>
+#include <sys/ttydefaults.h>
#include <sys/syslog.h>
#include <sys/time.h>
f = fdopen(fd, "r");
- if (get_cmd(f) != C_VER)
+ if (get_cmd(f) != C_VER) {
+ fclose(f);
return -1;
+ }
get_string(old_version, sizeof(old_version), f);
oops_error = 0;
for (pp = &family; (*pp = get_record(f)) != NULL; pp = &((*pp)->next))
/* Set ioctl settings to default ones */
console_stty();
- } else {
+ } else { /* parent */
+ int fd;
setsid();
- if ((f = console_open(O_RDWR|O_NOCTTY)) < 0) {
+ if ((fd = console_open(O_RDWR|O_NOCTTY)) < 0) {
initlog(L_VB, "open(%s): %s", console_dev,
strerror(errno));
- f = open("/dev/null", O_RDWR);
+ fd = open("/dev/null", O_RDWR);
}
- dup(f);
- dup(f);
+ dup(fd);
+ dup(fd);
}
/*
case POWEROKWAIT:
case CTRLALTDEL:
if (!(ch->flags & XECUTED)) ch->flags |= WAITING;
+ /* Fall through */
case KBREQUEST:
case BOOT:
case POWERFAIL:
case 0: /* Send TERM signal */
if (talk)
initlog(L_CO,
- "Sending processes the TERM signal");
+ "Sending processes configured via /etc/inittab the TERM signal");
kill(-(ch->pid), SIGTERM);
foundOne = 1;
break;
case 1: /* Send KILL signal and collect status */
if (talk)
initlog(L_CO,
- "Sending processes the KILL signal");
+ "Sending processes configured via /etc/inittab the KILL signal");
kill(-(ch->pid), SIGKILL);
break;
}
if (!strchr("0123456789SsQqAaBbCcUu", argv[optind][0]))
usage(progname);
request.cmd = INIT_CMD_RUNLVL;
- request.runlevel = env ? 0 : argv[optind][0];
+ request.runlevel = argv[optind][0];
request.sleeptime = sltime;
}