aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcoopgamma.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-07-20 20:55:26 +0200
committerMattias Andrée <maandree@kth.se>2016-07-20 20:55:26 +0200
commitadbaaf5282df1a4ac4d3432f9287f896b727c3a0 (patch)
tree36b18d1e639c6c1be728529456d163ac7643018d /src/libcoopgamma.c
parentIt is good practice to destroy after failed init (diff)
downloadlibcoopgamma-adbaaf5282df1a4ac4d3432f9287f896b727c3a0.tar.gz
libcoopgamma-adbaaf5282df1a4ac4d3432f9287f896b727c3a0.tar.bz2
libcoopgamma-adbaaf5282df1a4ac4d3432f9287f896b727c3a0.tar.xz
m fix
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'src/libcoopgamma.c')
-rw-r--r--src/libcoopgamma.c6
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)
}