diff options
author | Anders Kaseorg <andersk@mit.edu> | 2018-01-18 03:11:59 -0500 |
---|---|---|
committer | Anders Kaseorg <andersk@mit.edu> | 2018-01-18 19:25:05 -0500 |
commit | 10dca75fb21ce2e3b393c8fab40ddc423b2fb1fb (patch) | |
tree | 2a841371c81c257e8df0c4755d160d7ae4ae668e /src | |
parent | d4ce0d4f4f87017611e483b1437d29803b26e26b (diff) |
Type Select::got_signal as volatile sig_atomic_t
Fixes #634.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'src')
-rw-r--r-- | src/util/select.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/util/select.h b/src/util/select.h index 0403fcc..52771b9 100644 --- a/src/util/select.h +++ b/src/util/select.h @@ -74,7 +74,11 @@ private: void clear_got_signal( void ) { - memset( got_signal, 0, sizeof( got_signal ) ); + for ( volatile sig_atomic_t *p = got_signal; + p < got_signal + sizeof( got_signal ) / sizeof( *got_signal ); + p++ ) { + *p = 0; + } } /* not implemented */ @@ -227,9 +231,9 @@ private: int max_fd; - /* We assume writes to these ints are atomic, though we also try to mask out + /* We assume writes to got_signal are atomic, though we also try to mask out concurrent signal handlers. */ - int got_signal[ MAX_SIGNAL_NUMBER + 1 ]; + volatile sig_atomic_t got_signal[ MAX_SIGNAL_NUMBER + 1 ]; fd_set all_fds, read_fds; |