X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fnet%2Fsocket.cpp;h=2a1a71c0a4b3aa404b616f09a7be6e1799660c27;hb=HEAD;hp=877c1da2b99a31d586b9f5832717411cee96d625;hpb=ede42d5bb352841e2e425972e12b8ef31ddf2123;p=libs%2Fnet.git diff --git a/source/net/socket.cpp b/source/net/socket.cpp index 877c1da..2a1a71c 100644 --- a/source/net/socket.cpp +++ b/source/net/socket.cpp @@ -1,8 +1,8 @@ #include "platform_api.h" +#include "socket.h" #include #include #include "sockaddr_private.h" -#include "socket.h" #include "socket_private.h" using namespace std; @@ -29,8 +29,13 @@ Socket::Socket(Family af, int type, int proto): { mode = IO::M_RDWR; - // TODO use SOCK_CLOEXEC on Linux +#ifdef __linux__ + type |= SOCK_CLOEXEC; +#endif priv->handle = socket(family_to_sys(af), type, proto); +#ifndef __linux__ + set_inherit(false); +#endif platform_init(); }