summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-06-01 10:33:30 +0200
committerSebastien Helleu <flashcode@flashtux.org>2012-06-01 10:33:30 +0200
commitf56a936b220afb8daeeb6d26dc3da1dff84bd817 (patch)
tree1411fff3af44f63ca2fd5a0d26b2a145723cfbf3 /src/core
parent3209ebcb27f7cf06a041962d7caf2a7d34670dec (diff)
downloadweechat-f56a936b220afb8daeeb6d26dc3da1dff84bd817.zip
core: test return code when reading flags with fcntl (set flags to 0 if error)
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-network.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index ebc4c7597..e9573c3f6 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -958,6 +958,8 @@ network_connect_child_read_cb (void *arg_hook_connect, int fd)
*/
HOOK_CONNECT(hook_connect, handshake_fd_flags) =
fcntl (HOOK_CONNECT(hook_connect, sock), F_GETFL);
+ if (HOOK_CONNECT(hook_connect, handshake_fd_flags) == -1)
+ HOOK_CONNECT(hook_connect, handshake_fd_flags) = 0;
fcntl (HOOK_CONNECT(hook_connect, sock), F_SETFL,
HOOK_CONNECT(hook_connect, handshake_fd_flags) | O_NONBLOCK);
gnutls_transport_set_ptr (*HOOK_CONNECT(hook_connect, gnutls_sess),