MCPcopy Create free account
hub / github.com/chen3feng/toft / SetCloexec

Method SetCloexec

system/net/socket.cpp:76–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74 Return 0 on success, or -1 on error with errno set. */
75
76bool Socket::SetCloexec(int desc, bool value)
77{
78#ifdef __unix__
79 int oldflags = fcntl(desc, F_GETFD, 0);
80 if (oldflags < 0)
81 return false;
82
83 if (value)
84 oldflags |= FD_CLOEXEC;
85 else
86 oldflags &= ~FD_CLOEXEC;
87
88 return fcntl(desc, F_SETFD, oldflags) >= 0;
89#else
90 return true;
91#endif
92}
93
94
95bool Socket::GetLocalAddress(SocketAddress* address) const

Callers 1

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64