From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-987252-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 80AE9139082
	for <garchives@archives.gentoo.org>; Wed, 29 Nov 2017 22:10:48 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id C6196E0C09;
	Wed, 29 Nov 2017 22:10:47 +0000 (UTC)
Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id A4AD2E0C09
	for <gentoo-commits@lists.gentoo.org>; Wed, 29 Nov 2017 22:10:47 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 2410633BF05
	for <gentoo-commits@lists.gentoo.org>; Wed, 29 Nov 2017 22:10:46 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 7217DAC0E
	for <gentoo-commits@lists.gentoo.org>; Wed, 29 Nov 2017 22:10:44 +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: <1511992422.97a254f599db622d34a0c1bbd3057d1a7050a468.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:0.34.x commit in: src/rc/
X-VCS-Repository: proj/openrc
X-VCS-Files: src/rc/start-stop-daemon.c
X-VCS-Directories: src/rc/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 97a254f599db622d34a0c1bbd3057d1a7050a468
X-VCS-Branch: 0.34.x
Date: Wed, 29 Nov 2017 22:10:44 +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: 95f97eee-99d9-48cf-9522-7d8e17755e9f
X-Archives-Hash: ff3aaa4bb171f917f6dd58943a63fc99

commit:     97a254f599db622d34a0c1bbd3057d1a7050a468
Author:     Doug Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Wed Nov 29 20:10:39 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Nov 29 21:53:42 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=97a254f5

start-stop-daemon: properly handle missing pidfile

X-Gentoo-Bug: 639218
X-Gentoo-Bug-URL: https://bugs.gentoo.org/639218

 src/rc/start-stop-daemon.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index e98f8ba3..54b89b2a 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -657,8 +657,15 @@ int main(int argc, char **argv)
 			parse_schedule(applet, "0", sig);
 		else
 			parse_schedule(applet, NULL, sig);
+		if (pidfile) {
+			pid = get_pid(applet, pidfile);
+			if (pid == -1)
+				exit(EXIT_FAILURE);
+		} else {
+			pid = 0;
+		}
 		i = run_stop_schedule(applet, exec, (const char *const *)margv,
-		    get_pid(applet, pidfile), uid, test, progress, false);
+		    pid, uid, test, progress, false);
 
 		if (i < 0)
 			/* We failed to stop something */