From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-987243-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 4D328139082
	for <garchives@archives.gentoo.org>; Wed, 29 Nov 2017 21:12:43 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 87124E0BCF;
	Wed, 29 Nov 2017 21:12:42 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(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 64F5FE08DB
	for <gentoo-commits@lists.gentoo.org>; Wed, 29 Nov 2017 21:12:42 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(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 6E05933BEC7
	for <gentoo-commits@lists.gentoo.org>; Wed, 29 Nov 2017 21:12:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 360B0ABFF
	for <gentoo-commits@lists.gentoo.org>; Wed, 29 Nov 2017 21:12:40 +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: <1511986239.c84ebb94d19ca856fe064e15d2068d5671e360c9.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master 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: c84ebb94d19ca856fe064e15d2068d5671e360c9
X-VCS-Branch: master
Date: Wed, 29 Nov 2017 21:12:40 +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: f3d020d7-b8e2-4972-8353-eedd4319d01e
X-Archives-Hash: aa23286d92a72a06b8ccf7d033daa315

commit:     c84ebb94d19ca856fe064e15d2068d5671e360c9
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 20:10:39 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c84ebb94

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 */