Commit f88f2e11 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

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

parent 3ec959c7
......@@ -44,10 +44,22 @@
#error Bad configuration
#ifndef FD_CLOEXEC
#define FD_CLOEXEC (1)
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 (s != SOCKET_ERROR && su_socket_close_on_exec) {
fcntl(s, F_SETFD, FD_CLOEXEC); /* Close on exec */
return s;
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