aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorChris Sarra via Toybox <toybox@lists.landley.net>2020-09-01 19:22:32 -0700
committerRob Landley <rob@landley.net>2020-09-02 01:22:05 -0500
commit537e983f862d96933aa43325f5c1525378478acc (patch)
treeaa7c1d1b4c842c3fd7444d656d5598f14a02ebd0 /toys
parentfcba64ecad07c0756e0bb4ec3a79039d485590c9 (diff)
downloadtoybox-537e983f862d96933aa43325f5c1525378478acc.tar.gz
SIGHUP to init.c triggers inittab reload
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/init.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/toys/pending/init.c b/toys/pending/init.c
index 64b61481..b147911f 100644
--- a/toys/pending/init.c
+++ b/toys/pending/init.c
@@ -188,6 +188,25 @@ static void inittab_parsing(void)
}
}
+static void reload_inittab(void)
+{
+ // Remove all inactive actions, then reload /etc/inittab
+ struct action_list_seed **y;
+ y = &action_list_pointer;
+ while (*y) {
+ if (!(*y)->pid) {
+ struct action_list_seed *x = *y;
+ free(x->terminal_name);
+ free(x->command);
+ *y = (*y)->next;
+ free(x);
+ continue;
+ }
+ y = &(*y)->next;
+ }
+ inittab_parsing();
+}
+
static void run_command(char *command)
{
char *final_command[128];
@@ -405,7 +424,7 @@ static void restart_init_handler(int sig_no)
static void catch_signal(int sig_no)
{
caught_signal = sig_no;
- error_msg("signal seen");
+ error_msg("signal seen: %d", sig_no);
}
static void pause_handler(int sig_no)
@@ -439,6 +458,10 @@ static int check_if_pending_signals(void)
caught_signal = 0;
signal_caught = 1;
if (sig == SIGINT) run_action_from_list(CTRLALTDEL);
+ else if (sig == SIGHUP) {
+ error_msg("reloading inittab");
+ reload_inittab();
+ }
}
}