From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-883306-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id AA96013826A
	for <garchives@archives.gentoo.org>; Tue, 24 May 2016 16:43:31 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 8A413141CD;
	Tue, 24 May 2016 16:43:28 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id E4CED141CD
	for <gentoo-commits@lists.gentoo.org>; Tue, 24 May 2016 16:43:27 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E4539340931
	for <gentoo-commits@lists.gentoo.org>; Tue, 24 May 2016 16:43:26 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 443F0987
	for <gentoo-commits@lists.gentoo.org>; Tue, 24 May 2016 16:43:25 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1464019851.94077d264e14783e6ca5603d64e9d579fb206c20.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/
X-VCS-Repository: proj/openrc
X-VCS-Files: src/rc/supervise-daemon.c
X-VCS-Directories: src/rc/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 94077d264e14783e6ca5603d64e9d579fb206c20
X-VCS-Branch: master
Date: Tue, 24 May 2016 16:43:25 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: ee60ae5f-b4bb-4987-a798-733c630cf46c
X-Archives-Hash: 8a2a9bbc10a399f50a7411f10b80b70b

commit:     94077d264e14783e6ca5603d64e9d579fb206c20
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon May 23 16:06:40 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon May 23 16:10:51 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=94077d26

supervise-daemon: log the exit code or signal when a child process dies

 src/rc/supervise-daemon.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 2d8287f..c1ef169 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -702,8 +702,12 @@ int main(int argc, char **argv)
 				syslog(LOG_INFO, "stopping %s, pid %d", exec, child_pid);
 				kill(child_pid, SIGTERM);
 			} else {
-				syslog(LOG_INFO, "%s, pid %d, terminated unexpectedly",
-						exec, child_pid);
+				if (WIFEXITED(i))
+					syslog(LOG_INFO, "%s, pid %d, exited with return code %d",
+							exec, child_pid, WEXITSTATUS(i));
+				else if (WIFSIGNALED(i))
+					syslog(LOG_INFO, "%s, pid %d, terminated by signal %d",
+							exec, child_pid, WTERMSIG(i));
 				child_pid = fork();
 				if (child_pid == -1)
 					eerrorx("%s: fork: %s", applet, strerror(errno));