summaryrefslogtreecommitdiff
path: root/testing/syslog-ng/non-blocking-systemd-fds.patch
blob: bd056088bf22f1f5a41824b92ec7e7303850fff0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 2f214c4f87d944aa28d53e331a67b1fd88d9840f Mon Sep 17 00:00:00 2001
From: Balazs Scheidler <bazsi@balabit.hu>
Date: Wed, 22 Jun 2011 12:50:53 +0200
Subject: [PATCH] systemd: make sure the acquired fd is in non-blocking mode

The fd acquired from systemd is in blocking mode, and syslog-ng
didn't explicitly set it to non-blocking, causing syslog-ng
to stall. This patch changes that, explicitly enables
O_NONBLOCK and O_CLOEXEC on systemd acquired fds.

Reported-By: Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
---
 modules/afsocket/afunix.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/modules/afsocket/afunix.c b/modules/afsocket/afunix.c
index cd9c205..9a4e37b 100644
--- a/modules/afsocket/afunix.c
+++ b/modules/afsocket/afunix.c
@@ -108,6 +108,8 @@ afunix_sd_acquire_socket(AFSocketSourceDriver *s, gint *result_fd)
 
   if (*result_fd != -1)
     {
+      g_fd_set_nonblock(*result_fd, TRUE);
+      g_fd_set_cloexec(*result_fd, TRUE);
       msg_verbose("Acquired systemd socket",
 		  evt_tag_str("filename", self->filename),
 		  evt_tag_int("systemd-sock-fd", *result_fd),
-- 
1.7.5.4