diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libcoopgamma.c | 6 |
1 files 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) } |