X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2FAsyncServerSocket.cpp;h=908a95b6865fd6465a4eab52ff1db8cb9a6d1156;hp=72f29d0caef2daaae17bfade745a5fdee6f2413d;hb=7ebe7c2a249de44209e8bcc453e1a70bafd4ed19;hpb=bfa61031d36f41aaa907d40371c28ac0e84c8e0d diff --git a/folly/io/async/AsyncServerSocket.cpp b/folly/io/async/AsyncServerSocket.cpp index 72f29d0c..908a95b6 100644 --- a/folly/io/async/AsyncServerSocket.cpp +++ b/folly/io/async/AsyncServerSocket.cpp @@ -55,15 +55,17 @@ int setCloseOnExec(int fd, int value) { int old_flags = fcntl(fd, F_GETFD, 0); // If reading the flags failed, return error indication now - if (old_flags < 0) + if (old_flags < 0) { return -1; + } // Set just the flag we want to set int new_flags; - if (value != 0) + if (value != 0) { new_flags = old_flags | FD_CLOEXEC; - else + } else { new_flags = old_flags & ~FD_CLOEXEC; + } // Store modified flag word in the descriptor return fcntl(fd, F_SETFD, new_flags);