[Spice-devel] [PATCH xf86-video-qxl 3/4] Reopen the uinput socket after a close.

Christophe Fergeau cfergeau at redhat.com
Mon Oct 19 04:38:40 PDT 2015


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20151019/aa7d0afc/attachment-0001.sig>


More information about the Spice-devel mailing list