We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0cfb52c commit 73616c3Copy full SHA for 73616c3
src/libmongoc/src/mongoc/mongoc-socket.c
@@ -102,12 +102,17 @@ _mongoc_socket_setflags (int sd)
102
103
flags = fcntl (sd, F_GETFL, sd);
104
105
+ if (-1 == fcntl (sd, F_SETFL, (flags | O_NONBLOCK))) {
106
+ return false;
107
+ }
108
+
109
#ifdef FD_CLOEXEC
- return (-1 != fcntl (sd, F_SETFL, (flags | O_NONBLOCK | FD_CLOEXEC)));
-#else
- return (-1 != fcntl (sd, F_SETFL, (flags | O_NONBLOCK)));
110
+ flags = fcntl (sd, F_GETFD, sd);
111
+ if (-1 == fcntl (sd, F_SETFD, (flags | FD_CLOEXEC))) {
112
113
114
#endif
-
115
+ return true;
116
117
}
118
0 commit comments