nfs-utils/0001-close-the-syslog-fd-in-daemon_init.patch
Neil Brown d863115dc1 - 0001-close-the-syslog-fd-in-daemon_init.patch
Without this, tracing doesn't work
- 0001-mount.nfs-trust-the-exit-status-of-start_statd.patch
  (bsc#945937)
- 0001-mount-run-START_STATD-fully-as-root.patch
  (bsc#969152)

OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=161
2016-04-22 00:14:37 +00:00

42 lines
1.3 KiB
Diff

From 273b46473594b8aa4e55f682577d1dd94d44ad50 Mon Sep 17 00:00:00 2001
From: Scott Mayhew <smayhew@redhat.com>
Date: Mon, 2 Nov 2015 08:07:11 -0500
Subject: [PATCH] close the syslog fd in daemon_init()
Commit 7addf9d (cleanup daemonization code) added the following line to
mydaemon_init():
dup2(pipefds[1], 3);
If we've already called vsyslog() before the fork(), then chances are fd
3 was being used for the syslog socket. In that case the next vsyslog()
call will cause the data to appear on the read end of the pipe, causing
the parent to exit with a nonzero status. If systemd is running, it
will see the parent's nonzero exit status and will terminate the child
as well.
So just call closelog() to close the fd. The next call to vsyslog()
will open a new one if need be.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
support/nfs/mydaemon.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/nfs/mydaemon.c b/support/nfs/mydaemon.c
index 3391eff39008..701cfd914179 100644
--- a/support/nfs/mydaemon.c
+++ b/support/nfs/mydaemon.c
@@ -122,6 +122,7 @@ daemon_init(bool fg)
dup2(tempfd, 0);
dup2(tempfd, 1);
dup2(tempfd, 2);
+ closelog();
dup2(pipefds[1], 3);
pipefds[1] = 3;
closeall(4);
--
2.8.1