File audit-Fix-hang-on-startup.patch of Package audit.15296

From ee6608eca034494fc2597b2990852adec236e486 Mon Sep 17 00:00:00 2001
From: Steve Grubb <sgrubb@redhat.com>
Date: Wed, 27 Jun 2018 08:58:59 -0400
Subject: [PATCH] Fix hang on startup
References: bsc#1156159
Upstream: yes, ee6608eca034494fc2597b2990852adec236e486
Signed-off-by: tabraham@suse.com
Signed-off-by: ematsumiya@suse.com
[tabraham@suse.com: removed ChangeLog changes from patch]
---
 src/auditd-dispatch.c | 1 -
 src/auditd.c          | 6 ++++--
 3 files changed, 5 insertions(+), 3 deletions(-)

Index: audit-2.8.1/src/auditd-dispatch.c
===================================================================
--- audit-2.8.1.orig/src/auditd-dispatch.c
+++ audit-2.8.1/src/auditd-dispatch.c
@@ -47,7 +47,6 @@ int dispatcher_pid(void)
 
 void dispatcher_reaped(void)
 {
-	audit_msg(LOG_INFO, "dispatcher %d reaped", pid);
 	pid = 0;
 	shutdown_dispatcher();
 }
Index: audit-2.8.1/src/auditd.c
===================================================================
--- audit-2.8.1.orig/src/auditd.c
+++ audit-2.8.1/src/auditd.c
@@ -366,7 +366,7 @@ static int become_daemon(void)
 	if (do_fork) {
 		if (pipe(init_pipe) || 
 				fcntl(init_pipe[0], F_SETFD, FD_CLOEXEC) ||
-				fcntl(init_pipe[0], F_SETFD, FD_CLOEXEC))
+				fcntl(init_pipe[1], F_SETFD, FD_CLOEXEC))
 			return -1;
 		pid = fork();
 	} else
@@ -410,7 +410,9 @@ static int become_daemon(void)
 			break;
 		default:
 			/* Wait for the child to say its done */
-			rc = read(init_pipe[0], &status, sizeof(status));
+			do {
+				rc = read(init_pipe[0], &status,sizeof(status));
+			} while (rc < 0 && errno == EINTR);
 			if (rc < 0)
 				return -1;
 
openSUSE Build Service is sponsored by