void
_dbus_fd_set_close_on_exec (int handle)
{
-#ifdef ENABLE_DBUSSOCKET
- DBusSocket *s;
- if (handle < 0)
- return;
-
- _dbus_lock_sockets();
-
- _dbus_handle_to_socket_unlocked (handle, &s);
- s->close_on_exec = TRUE;
-
- _dbus_unlock_sockets();
-#else
- /* TODO unic code.
- int val;
-
- val = fcntl (fd, F_GETFD, 0);
-
- if (val < 0)
- return;
-
- val |= FD_CLOEXEC;
-
- fcntl (fd, F_SETFD, val);
- */
-#endif
+ if ( !SetHandleInformation( (HANDLE) handle,
+ HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE,
+ 0 /*disable both flags*/ ) )
+ {
+ _dbus_win_warn_win_error ("Disabling socket handle inheritance failed:", GetLastError());
+ }
}
/**