summaryrefslogtreecommitdiff
path: root/src/or/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-25 21:39:42 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-25 21:39:42 +0000
commit5c670a186c1f45a2ddfcab00c065f994d8a888f7 (patch)
treed562ce3be020fb2657d5b84a4ea5257c42b64e7f /src/or/control.c
parentc928b85cfa17c6f03aeeaa10fd284b0cc15bcf93 (diff)
downloadtor-5c670a186c1f45a2ddfcab00c065f994d8a888f7.tar.gz
tor-5c670a186c1f45a2ddfcab00c065f994d8a888f7.zip
r9386@Kushana: nickm | 2006-10-25 17:35:38 -0400
Resolve bug 347: translate v0 controller signal numbers into internal signal numbers; leave v1 signal numbers alone. svn:r8828
Diffstat (limited to 'src/or/control.c')
-rw-r--r--src/or/control.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 0947ad2a0a..60a233211d 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -1252,6 +1252,18 @@ handle_control_signal(control_connection_t *conn, uint32_t len,
return 0;
} else {
sig = (uint8_t)body[0];
+ switch (sig)
+ {
+ case 1: sig = SIGHUP; break;
+ case 2: sig = SIGINT; break;
+ case 10: sig = SIGUSR1; break;
+ case 12: sig = SIGUSR2; break;
+ case 15: sig = SIGTERM; break;
+ case SIGNEWNYM: break;
+ default:
+ send_control0_error(conn, ERR_SYNTAX, "Unrecognized signal number.");
+ return 0;
+ }
}
} else {
int n = 0;
@@ -1281,17 +1293,9 @@ handle_control_signal(control_connection_t *conn, uint32_t len,
return 0;
}
- if (!control_signal_check(sig)) {
- if (STATE_IS_V0(conn->_base.state))
- send_control0_error(conn, ERR_SYNTAX, "Unrecognized signal number.");
- else
- connection_write_str_to_buf("551 Unable to act on signal\r\n",
- conn);
- } else {
- /* Send DONE first, in case the signal makes us shut down. */
- send_control_done(conn);
- control_signal_act(sig);
- }
+ /* Send DONE first, in case the signal makes us shut down. */
+ send_control_done(conn);
+ control_signal_act(sig);
return 0;
}