From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Rgonx-00061k-A0 for garchives@archives.gentoo.org; Sat, 31 Dec 2011 02:36:17 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 85C4C21C01F; Sat, 31 Dec 2011 02:36:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 38B6D21C01F for ; Sat, 31 Dec 2011 02:36:07 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A27D11B4002 for ; Sat, 31 Dec 2011 02:36:06 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 06B1D80043 for ; Sat, 31 Dec 2011 02:36:06 +0000 (UTC) From: "Christian Ruppert" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Christian Ruppert" Message-ID: <34b7632d1d2ed38c7251ac8c2869c8fc416a99f5.idl0r@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/runscript.c X-VCS-Directories: src/rc/ X-VCS-Committer: idl0r X-VCS-Committer-Name: Christian Ruppert X-VCS-Revision: 34b7632d1d2ed38c7251ac8c2869c8fc416a99f5 Date: Sat, 31 Dec 2011 02:36:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: fd615cf8-07a1-4b38-8f79-3351d2c6ebe2 X-Archives-Hash: 3f7e149256b2bc776857c6d0f13b2d67 commit: 34b7632d1d2ed38c7251ac8c2869c8fc416a99f5 Author: Christian Ruppert gentoo org> AuthorDate: Sat Dec 31 02:35:32 2011 +0000 Commit: Christian Ruppert gentoo org> CommitDate: Sat Dec 31 02:35:32 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D34b7632d Do not exit immediately when a service has been stopped already The old behaviour was to exit(EXIT_SUCCESS) in case the service has been = stopped already, even if further commands has been passed to the init script (like zap, start). So using for example /etc/init.d/foo stop zap start would abort immediate= ly after "stop" if the service has been stopped already. Though there may be= cases were we need it to proceed with the remaining commands, zap and start in = this case. This patch fixes the behaviour to continue and proceed with the remaining commands whenever necessary. X-Gentoo-Bug: 371845 X-Gentoo-Bug-URL: https://bugs.gentoo.org/371845 --- src/rc/runscript.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/rc/runscript.c b/src/rc/runscript.c index cd53b34..2f66971 100644 --- a/src/rc/runscript.c +++ b/src/rc/runscript.c @@ -821,7 +821,7 @@ svc_start(void) svc_start_real(); } =20 -static void +static int svc_stop_check(RC_SERVICE *state) { *state =3D rc_service_state(service); @@ -848,7 +848,7 @@ svc_stop_check(RC_SERVICE *state) =20 if (*state & RC_SERVICE_STOPPED) { ewarn("WARNING: %s is already stopped", applet); - exit(EXIT_SUCCESS); + return 1; } =20 rc_service_mark(service, RC_SERVICE_STOPPING); @@ -861,6 +861,8 @@ svc_stop_check(RC_SERVICE *state) else if (rc_service_in_runlevel(service, RC_LEVEL_BOOT)) ewarn("WARNING: you are stopping a boot service"); } + + return 0; } =20 static void @@ -986,7 +988,7 @@ svc_stop_real(void) rc_plugin_run(RC_HOOK_SERVICE_STOP_OUT, applet); } =20 -static void +static int svc_stop(void) { RC_SERVICE state; @@ -995,13 +997,16 @@ svc_stop(void) if (dry_run) einfon("stop:"); else - svc_stop_check(&state); + if (svc_stop_check(&state) =3D=3D 1) + return 1; /* Service has been stopped already */ if (deps) svc_stop_deps(state); if (dry_run) printf(" %s\n", applet); else svc_stop_real(); + + return 0; } =20 static void @@ -1351,7 +1356,8 @@ runscript(int argc, char **argv) } if (deps && in_background) get_started_services(); - svc_stop(); + if (svc_stop() =3D=3D 1) + continue; /* Service has been stopped already */ if (deps) { if (!in_background && !rc_runlevel_stopping() &&