Skip to content

Commit

Permalink
poll() doesn't return -errno
Browse files Browse the repository at this point in the history
  • Loading branch information
emersion committed Nov 11, 2018
1 parent b5a2995 commit 5d20b35
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions event-loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ void finish_event_loop(struct mako_event_loop *loop) {
}
}

static int poll_event_loop(struct mako_event_loop *loop) {
return poll(loop->fds, MAKO_EVENT_COUNT, -1);
}

static void timespec_add(struct timespec *t, int delta_ms) {
static const long ms = 1000000, s = 1000000000;

Expand Down Expand Up @@ -190,13 +186,14 @@ int run_event_loop(struct mako_event_loop *loop) {

int ret = 0;
while (loop->running) {
ret = poll_event_loop(loop);
errno = 0;
ret = poll(loop->fds, MAKO_EVENT_COUNT, -1);
if (!loop->running) {
ret = 0;
break;
}
if (ret < 0) {
fprintf(stderr, "failed to poll(): %s\n", strerror(-ret));
fprintf(stderr, "failed to poll(): %s\n", strerror(errno));
break;
}

Expand Down

0 comments on commit 5d20b35

Please # to comment.