From: Ruben Kerkhof Date: Tue, 8 Sep 2015 14:11:56 +0000 (+0200) Subject: notify_systemd: use close-on-exit on socket X-Git-Tag: collectd-5.6.0~591^2~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d25bd327aec086cb86b39e611d65742eada9b4a4;p=collectd.git notify_systemd: use close-on-exit on socket --- diff --git a/src/daemon/collectd.c b/src/daemon/collectd.c index 58325b95..02fd66f8 100644 --- a/src/daemon/collectd.c +++ b/src/daemon/collectd.c @@ -459,7 +459,11 @@ int notify_systemd (void) unsetenv ("NOTIFY_SOCKET"); +#if defined(SOCK_CLOEXEC) + fd = socket (AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, /* protocol = */ 0); +#else fd = socket (AF_UNIX, SOCK_DGRAM, /* protocol = */ 0); +#endif if (fd < 0) { char errbuf[1024]; ERROR ("creating UNIX socket failed: %s",