On Fri, Oct 16, 2015 at 04:06:28PM -0500, Jeremy White wrote: > >> > > >> static void spiceqxl_uinput_read_cb(int fd, int event, void > >> *opaque) { @@ -30,14 +31,20 @@ static void > >> spiceqxl_uinput_read_cb(int fd, int event, void *opaque) static > >> int y = -1; static int buttons_state = 0; int button = -1; + > >> qxl_screen_t *qxl = (qxl_screen_t *) opaque; > >> > >> n = read(uinput_fd, (char *)&inp_event + offset, > >> sizeof(inp_event) - offset); - if (n == -1) { - if > >> (errno != EAGAIN && errno != EINTR && errno != EWOULDBLOCK) { - > >> fprintf(stderr, "spice: uinput read failed: %s\n", > >> strerror(errno)); - } + if (n == -1 && + > >> (errno == EAGAIN || errno == EINTR || errno == EWOULDBLOCK)) > >> return; + + if (n <= 0) { + fprintf(stderr, "spice: > >> uinput read failed: %d-%s\n", n, n == 0 ? "closed" : > >> strerror(errno)); + spiceqxl_uinput_term(qxl); + > >> spiceqxl_uinput_init(qxl); + return; } + > > > > Nit, I think you could keep it like if (n == -1) { if (errno != > > EAGAIN || ...) { /* reopen uinput socket */ } return; } I think it > > would be slightly more readable. Or did you want to save an > > indentation level ? > > mm. I think you overlooked the n == 0 case; that makes your proposal > a bit more convoluted. Ah right. This was just a nit anyway, I'm fine with the patch as is ;) Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel