On Thu, Mar 30, 2017 at 12:27:06PM -0500, Jeremy White wrote: > Hi, > > On 03/16/2017 10:02 AM, Christophe Fergeau wrote: > > This allows to move some low-level code out of reds.c > > > > Signed-off-by: Christophe Fergeau <cfergeau@xxxxxxxxxx> > > --- > > server/net-utils.c | 24 ++++++++++++++++++++++++ > > server/net-utils.h | 1 + > > server/reds.c | 13 ++----------- > > 3 files changed, 27 insertions(+), 11 deletions(-) > > > > diff --git a/server/net-utils.c b/server/net-utils.c > > index 10f447b..0e533f5 100644 > > --- a/server/net-utils.c > > +++ b/server/net-utils.c > > @@ -52,3 +52,27 @@ bool red_socket_set_no_delay(int fd, bool no_delay) > > > > return true; > > } > > + > > +/** > > + * red_socket_set_non_blocking: > > + * @fd: a socket file descriptor > > + * @non_blocking: whether to enable O_NONBLOCK on @fd > > + * > > + * Returns: #true if the operation succeeded, #false otherwise. > > + */ > > +bool red_socket_set_non_blocking(int fd, bool non_blocking) > > +{ > > + int flags; > > + > > + if ((flags = fcntl(fd, F_GETFL)) == -1) { > > + spice_warning("fnctl(F_GETFL) failed, %s", strerror(errno)); > > + return false; > > + } > > + > > + if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) { > > + spice_warning("fnctl(F_SETFL) failed, %s", strerror(errno)); > > + return false; > > + } > > + > > + return true; > > +} > > Doesn't this ignore the non_blocking parameter? Oops, thanks a lot for catching this! Too hasty copy and paste! v4 incoming :) Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel