diff options
author | Mattias Andrée <maandree@kth.se> | 2016-07-20 20:55:26 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2016-07-20 20:55:26 +0200 |
commit | adbaaf5282df1a4ac4d3432f9287f896b727c3a0 (patch) | |
tree | 36b18d1e639c6c1be728529456d163ac7643018d | |
parent | It is good practice to destroy after failed init (diff) | |
download | libcoopgamma-adbaaf5282df1a4ac4d3432f9287f896b727c3a0.tar.gz libcoopgamma-adbaaf5282df1a4ac4d3432f9287f896b727c3a0.tar.bz2 libcoopgamma-adbaaf5282df1a4ac4d3432f9287f896b727c3a0.tar.xz |
m fix
Signed-off-by: Mattias Andrée <maandree@kth.se>
-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) } |