summaryrefslogtreecommitdiffstats
path: root/lib/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/socket.c')
-rw-r--r--lib/socket.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/socket.c b/lib/socket.c
index 628a96d..01cc219 100644
--- a/lib/socket.c
+++ b/lib/socket.c
@@ -192,6 +192,12 @@ static struct nl_sock *__alloc_socket(struct nl_cb *cb)
sk->s_peer.nl_family = AF_NETLINK;
sk->s_seq_expect = sk->s_seq_next = time(NULL);
+#ifdef SOCK_CLOEXEC
+ sk->s_cloexec = 1;
+#else
+ sk->s_cloexec = 0;
+#endif
+
/* the port is 0 (unspecified), meaning NL_OWN_PORT */
sk->s_flags = NL_OWN_PORT;