summaryrefslogtreecommitdiff
path: root/src/feature/control/control_events.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-02-10 14:23:13 -0500
committerNick Mathewson <nickm@torproject.org>2020-02-10 14:23:13 -0500
commiteb8841cd9553d1bd7804018963abacf93a088f74 (patch)
tree955184790af4929f9440866035314feb46ce1a2b /src/feature/control/control_events.c
parentd9144700af5602cc267c0d147145c100567fdbb3 (diff)
parentb2c3cb1b26c41969776ed1fd1b20588430346e45 (diff)
downloadtor-eb8841cd9553d1bd7804018963abacf93a088f74.tar.gz
tor-eb8841cd9553d1bd7804018963abacf93a088f74.zip
Merge branch 'bug33104_041'
Diffstat (limited to 'src/feature/control/control_events.c')
-rw-r--r--src/feature/control/control_events.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/feature/control/control_events.c b/src/feature/control/control_events.c
index b0a1a3f242..916ccea875 100644
--- a/src/feature/control/control_events.c
+++ b/src/feature/control/control_events.c
@@ -1559,29 +1559,17 @@ control_event_signal(uintptr_t signal_num)
if (!control_event_is_interesting(EVENT_GOT_SIGNAL))
return 0;
- switch (signal_num) {
- case SIGHUP:
- signal_string = "RELOAD";
+ for (unsigned i = 0; signal_table[i].signal_name != NULL; ++i) {
+ if ((int)signal_num == signal_table[i].sig) {
+ signal_string = signal_table[i].signal_name;
break;
- case SIGUSR1:
- signal_string = "DUMP";
- break;
- case SIGUSR2:
- signal_string = "DEBUG";
- break;
- case SIGNEWNYM:
- signal_string = "NEWNYM";
- break;
- case SIGCLEARDNSCACHE:
- signal_string = "CLEARDNSCACHE";
- break;
- case SIGHEARTBEAT:
- signal_string = "HEARTBEAT";
- break;
- default:
- log_warn(LD_BUG, "Unrecognized signal %lu in control_event_signal",
- (unsigned long)signal_num);
- return -1;
+ }
+ }
+
+ if (signal_string == NULL) {
+ log_warn(LD_BUG, "Unrecognized signal %lu in control_event_signal",
+ (unsigned long)signal_num);
+ return -1;
}
send_control_event(EVENT_GOT_SIGNAL, "650 SIGNAL %s\r\n",