Skip to content

Commit

Permalink
Fixup the ppoll compat implementation.
Browse files Browse the repository at this point in the history
Use volatile sigatomic_t for the signal handler variable and make
sure the signal mask is reset back in all cases.
  • Loading branch information
cjeker committed Oct 5, 2023
1 parent 8616f5f commit c7d7877
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions compat/ppoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <signal.h>
#include <time.h>

static sig_atomic_t signaled;
static volatile sig_atomic_t signaled;
static void (*sigfunc)(int);
static int initalized;

Expand Down Expand Up @@ -62,10 +62,9 @@ ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
/* check if signal was pending and fired */
if (signaled) {
errno = EINTR;
return -1;
}

rc = poll(fds, nfds, t);
rc = -1;
} else
rc = poll(fds, nfds, t);

saved_errno = errno;
if (mask)
Expand Down

0 comments on commit c7d7877

Please sign in to comment.