#define VT_LOG "/dev/tty5" /* Virtual console */
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
-#define SHELL "-/bin/sh" /* Default shell */
+#define SHELL "/bin/sh" /* Default shell */
+#define LOGIN_SHELL "-" SHELL /* Default login shell */
#define INITTAB "/etc/inittab" /* inittab file location */
#ifndef INIT_SCRIPT
#define INIT_SCRIPT "/etc/init.d/rcS" /* Default sysinit script. */
static void delete_initAction(initAction * action);
-
+static void loop_forever()
+{
+ while (1)
+ sleep (1);
+}
/* Print a message to the specified device.
* Device may be bitwise-or'd from LOG | CONSOLE */
termType,
"HOME=/",
"PATH=/usr/bin:/bin:/usr/sbin:/sbin",
- "SHELL=/bin/sh",
+ "SHELL=" SHELL,
"USER=root",
NULL
};
goodnight:
message(CONSOLE,
"Sorry, your computer does not have enough memory.\r\n");
- while (1)
- sleep(1);
+ loop_forever();
}
/* Run all commands to be run right before halt/reboot */
init_reboot(RB_POWER_OFF);
else
init_reboot(RB_HALT_SYSTEM);
- exit(0);
+
+ loop_forever();
}
static void reboot_signal(int sig)
sleep(2);
init_reboot(RB_AUTOBOOT);
- exit(0);
+
+ loop_forever();
}
static void ctrlaltdel_signal(int sig)
newAction = calloc((size_t) (1), sizeof(initAction));
if (!newAction) {
message(LOG | CONSOLE, "Memory allocation failure\n");
- while (1)
- sleep(1);
+ loop_forever();
}
newAction->nextPtr = initActionList;
initActionList = newAction;
/* Umount all filesystems on halt/reboot */
new_initAction(SHUTDOWN, "/bin/umount -a -r", console);
/* Askfirst shell on tty1 */
- new_initAction(ASKFIRST, SHELL, console);
+ new_initAction(ASKFIRST, LOGIN_SHELL, console);
/* Askfirst shell on tty2 */
if (secondConsole != NULL)
- new_initAction(ASKFIRST, SHELL, secondConsole);
+ new_initAction(ASKFIRST, LOGIN_SHELL, secondConsole);
/* Askfirst shell on tty3 */
if (thirdConsole != NULL)
- new_initAction(ASKFIRST, SHELL, thirdConsole);
+ new_initAction(ASKFIRST, LOGIN_SHELL, thirdConsole);
/* Askfirst shell on tty4 */
if (fourthConsole != NULL)
- new_initAction(ASKFIRST, SHELL, fourthConsole);
+ new_initAction(ASKFIRST, LOGIN_SHELL, fourthConsole);
/* sysinit */
new_initAction(SYSINIT, INIT_SCRIPT, console);
!strcmp(argv[1], "-s") || !strcmp(argv[1], "1"))) {
/* Ask first then start a shell on tty2-4 */
if (secondConsole != NULL)
- new_initAction(ASKFIRST, SHELL, secondConsole);
+ new_initAction(ASKFIRST, LOGIN_SHELL, secondConsole);
if (thirdConsole != NULL)
- new_initAction(ASKFIRST, SHELL, thirdConsole);
+ new_initAction(ASKFIRST, LOGIN_SHELL, thirdConsole);
if (fourthConsole != NULL)
- new_initAction(ASKFIRST, SHELL, fourthConsole);
+ new_initAction(ASKFIRST, LOGIN_SHELL, fourthConsole);
/* Start a shell on tty1 */
- new_initAction(RESPAWN, SHELL, console);
+ new_initAction(RESPAWN, LOGIN_SHELL, console);
} else {
/* Not in single user mode -- see what inittab says */
if (initActionList == NULL) {
message(LOG | CONSOLE,
"No more tasks for init -- sleeping forever.\n");
- while (1)
- sleep(1);
+ loop_forever();
}
/* Now run the looping stuff for the rest of forever */