diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-02-20 16:31:53 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-02-20 16:31:53 +0000 |
commit | 4098c23060bcf75ecf2662be5a7edc21da93c794 (patch) | |
tree | fdd792da4ddab31faacceb8c5f4821a4b78a217c | |
parent | 6039f81e4886071d61e5cfebc3b16e9ab0b8f01f (diff) | |
download | rspamd-4098c23060bcf75ecf2662be5a7edc21da93c794.tar.gz rspamd-4098c23060bcf75ecf2662be5a7edc21da93c794.zip |
Set cloexec flag to sockets obtained from systemd.
-rw-r--r-- | src/main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index a8196ef06..ba091a7f0 100644 --- a/src/main.c +++ b/src/main.c @@ -552,7 +552,7 @@ create_listen_socket (const gchar *addr, gint port, gint listen_type) static GList * systemd_get_socket (gint number, gint listen_type) { - int sock, max; + int sock, max, flags; GList *result = NULL; const gchar *e; gchar *err; @@ -578,6 +578,10 @@ systemd_get_socket (gint number, gint listen_type) return NULL; } } + flags = fcntl (sock, F_GETFD); + if (flags != -1) { + (void)fcntl (sock, F_SETFD, flags | FD_CLOEXEC); + } result = g_list_prepend (result, GINT_TO_POINTER (sock)); } else if (max <= number + sd_listen_fds_start) { |