aboutsummaryrefslogtreecommitdiff
path: root/src/rc.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-20 15:02:13 +0000
committerRoy Marples <roy@marples.name>2007-04-20 15:02:13 +0000
commita5ba34ec151e4e18d7b732dac1517d21a1df3710 (patch)
treee42e1cf3fcfe60f480407506623f9dd54d168b13 /src/rc.c
parent7590e7b258d34124f070b4cd01fa6cc7caa29920 (diff)
Fix rc-abort to notify the plugins we are aborting
Diffstat (limited to 'src/rc.c')
-rw-r--r--src/rc.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/rc.c b/src/rc.c
index 375800af..4910b733 100644
--- a/src/rc.c
+++ b/src/rc.c
@@ -320,11 +320,7 @@ static char read_key (bool block)
{
struct termios termios;
char c = 0;
-
- /* This locks up rc for some reason!
- * Why? it used to work fine... */
- return 0;
-
+
if (! isatty (STDIN_FILENO))
return (false);
@@ -456,6 +452,8 @@ static void handle_signal (int sig)
{
int serrno = errno;
char signame[10] = { '\0' };
+ char *run;
+ char *prev;
switch (sig) {
case SIGINT:
@@ -474,8 +472,14 @@ static void handle_signal (int sig)
signal (SIGTERM, SIG_IGN);
killpg (getpgrp (), SIGTERM);
- /* If we're in boot runlevel then change into single-user mode */
- if (strcmp (rc_get_runlevel (), RC_LEVEL_BOOT) == 0)
+ /* Notify plugins we are aborting */
+ rc_plugin_run (rc_hook_abort, "rc");
+
+ run = getenv ("RUNLEVEL");
+ prev = getenv ("PREVLEVEL");
+ /* Only drop into single user mode if we're booting */
+ if ((prev && strcmp (prev, "S") == 0) ||
+ (run && strcmp (run, "S") == 0))
single_user ();
exit (EXIT_FAILURE);
@@ -557,9 +561,6 @@ int main (int argc, char **argv)
atexit (cleanup);
newlevel = argv[0];
- /* Start a new process group */
- setpgrp();
-
/* Setup a signal handler */
signal (SIGINT, handle_signal);
signal (SIGQUIT, handle_signal);