diff --git a/examples/joystick.c b/examples/joystick.c index 9513b7e..51d65e5 100644 --- a/examples/joystick.c +++ b/examples/joystick.c @@ -43,11 +43,15 @@ struct js_event { */ static void joystick_cb(uev_t *w, void *arg, int events) { - if (UEV_ERROR == events) - errx(EBADF, "Unrecoverable error, exiting"); + if (UEV_ERROR == events) { + warnx("Spurious problem with the joystick watcher, restarting."); + uev_io_start(w); + } - if (read(w->fd, &e, sizeof(e)) < 0) - errx(errno, "Failed reading joystick event"); + if (read(w->fd, &e, sizeof(e)) < 0) { + warn("Failed reading joystick event"); + return; + } switch (e.type) { case 1: diff --git a/examples/redirect.c b/examples/redirect.c index 6e890b3..a8aefa2 100644 --- a/examples/redirect.c +++ b/examples/redirect.c @@ -24,8 +24,10 @@ void process_stdin(uev_t *w, void *arg, int events) char buf[256]; int len; - if (UEV_ERROR == events) - errx(EBADF, "Unrecoverable error, exiting"); + if (UEV_ERROR == events) { + warnx("Spurious problem with the stdin watcher, restarting."); + uev_io_start(w); + } len = read(w->fd, buf, sizeof(buf)); if (len == -1) {