Skip to content

Commit

Permalink
Type Select::got_signal as volatile sig_atomic_t
Browse files Browse the repository at this point in the history
Fixes mobile-shell#634.

Signed-off-by: Anders Kaseorg <[email protected]>
  • Loading branch information
andersk committed Jan 19, 2018
1 parent d4ce0d4 commit 10dca75
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/select.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ class Select {

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 */
Expand Down Expand Up @@ -227,9 +231,9 @@ class Select {

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;

Expand Down

0 comments on commit 10dca75

Please sign in to comment.