diff options
author | cypherpunks <cypherpunks@torproject.org> | 2015-07-02 09:43:20 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-07-21 14:06:15 -0400 |
commit | 2d3f88f6b9c4db7a4f65f1dcebae296f662cbeb7 (patch) | |
tree | 94ea1e1cb839afe7580981ccac7fe4ae0fcc18ce /src/or/main.c | |
parent | f4b03f936ef6f97e8710af75b829f0621f0f2433 (diff) | |
download | tor-2d3f88f6b9c4db7a4f65f1dcebae296f662cbeb7.tar.gz tor-2d3f88f6b9c4db7a4f65f1dcebae296f662cbeb7.zip |
Remove casting of void pointers when handling signals.
Diffstat (limited to 'src/or/main.c')
-rw-r--r-- | src/or/main.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/or/main.c b/src/or/main.c index fe93cdc12d..5bff82b3cf 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -2227,7 +2227,8 @@ run_main_loop_until_done(void) static void signal_callback(int fd, short events, void *arg) { - uintptr_t sig = (uintptr_t)arg; + const int *sigptr = arg; + const int sig = *sigptr; (void)fd; (void)events; @@ -2237,7 +2238,7 @@ signal_callback(int fd, short events, void *arg) /** Do the work of acting on a signal received in <b>sig</b> */ void -process_signal(uintptr_t sig) +process_signal(int sig) { switch (sig) { @@ -2482,9 +2483,10 @@ handle_signals(int is_parent) static struct event *signal_events[16]; /* bigger than it has to be. */ if (is_parent) { for (i = 0; signals[i] >= 0; ++i) { - signal_events[i] = tor_evsignal_new( - tor_libevent_get_base(), signals[i], signal_callback, - (void*)(uintptr_t)signals[i]); + signal_events[i] = tor_evsignal_new(tor_libevent_get_base(), signals[i], + signal_callback, + /* Cast away const */ + (int*)&signals[i]); if (event_add(signal_events[i], NULL)) log_warn(LD_BUG, "Error from libevent when adding event for signal %d", signals[i]); |