Commit f88f2e11 authored by Pekka Pessi's avatar Pekka Pessi

su.c: if su_socket_close_on_exec is non-zero, su_socket() will set close-on-exec flag on.

darcs-hash:20060823142616-65a35-1e32c864eaf4445f67736c6087ce3dd8de69b8e7.gz
parent 3ec959c7
......@@ -44,10 +44,22 @@
#error Bad configuration
#endif
#ifndef FD_CLOEXEC
#define FD_CLOEXEC (1)
#endif
int su_socket_close_on_exec = 0;
/** Create an endpoint for communication. */
su_socket_t su_socket(int af, int sock, int proto)
{
return socket(af, sock, proto);
su_socket_t s = socket(af, sock, proto);
#if SU_HAVE_BSDSOCK
if (s != SOCKET_ERROR && su_socket_close_on_exec) {
fcntl(s, F_SETFD, FD_CLOEXEC); /* Close on exec */
}
#endif
return s;
}
#if SU_HAVE_BSDSOCK
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment