From adbaaf5282df1a4ac4d3432f9287f896b727c3a0 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 20 Jul 2016 20:55:26 +0200 Subject: m fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/libcoopgamma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcoopgamma.c b/src/libcoopgamma.c index 63e7d99..4d11d4a 100644 --- a/src/libcoopgamma.c +++ b/src/libcoopgamma.c @@ -1422,13 +1422,13 @@ int libcoopgamma_connect(const char* restrict method, const char* restrict site, int libcoopgamma_set_nonblocking(libcoopgamma_context_t* restrict ctx, int nonblocking) { int flags = fcntl(ctx->fd, F_GETFL); + if (flags == -1) + return -1; if (nonblocking) flags |= O_NONBLOCK; else flags &= ~O_NONBLOCK; - if (fcntl(ctx->fd, F_SETFL, flags) == -1) - return -1; - return 0; + return -(fcntl(ctx->fd, F_SETFL, flags) == -1) } -- cgit v1.2.3-70-g09d2