mirror of
https://github.com/troglobit/libuev.git
synced 2026-10-01 05:22:25 +07:00
Make sure to restart the I/O watcher on UEV_ERROR
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
+8
-4
@@ -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:
|
||||
|
||||
+4
-2
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user