summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEray Aslan <eras@gentoo.org>2011-01-12 19:46:11 -0600
committerWilliam Hubbs <williamh@gentoo.org>2011-01-12 19:46:11 -0600
commit66abbefd6c389642aedd32f89285de32223b3da6 (patch)
tree094668e44e2cdcfbf93698de70f08cba3dca05d6
parent84eda608c8ef98dc685289d2df595ea8866abf37 (diff)
downloadopenrc-66abbefd6c389642aedd32f89285de32223b3da6.tar.gz
openrc-66abbefd6c389642aedd32f89285de32223b3da6.tar.bz2
openrc-66abbefd6c389642aedd32f89285de32223b3da6.tar.xz
bug 351160: make openrc exit codes LSB compliant
* status on a stopped service now has a return code of 3 (was 1) * starting an already started service now has a return code of 0 (was 1) * stopping an already stopped service now has a return code of 0 (was 1)
-rw-r--r--sh/runscript.sh.in2
-rw-r--r--src/rc/runscript.c12
2 files changed, 9 insertions, 5 deletions
diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index 4e8e215..947c2f7 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -101,7 +101,7 @@ _status()
return 0
else
einfo "status: stopped"
- return 1
+ return 3
fi
}
diff --git a/src/rc/runscript.c b/src/rc/runscript.c
index f3f0517..1c60c24 100644
--- a/src/rc/runscript.c
+++ b/src/rc/runscript.c
@@ -596,8 +596,10 @@ svc_start_check(void)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
- if (state & RC_SERVICE_STARTED)
- ewarnx("WARNING: %s has already been started", applet);
+ if (state & RC_SERVICE_STARTED) {
+ ewarn("WARNING: %s has already been started", applet);
+ exit(EXIT_SUCCESS);
+ }
else if (state & RC_SERVICE_INACTIVE && !in_background)
ewarnx("WARNING: %s has already started, but is inactive",
applet);
@@ -845,8 +847,10 @@ svc_stop_check(RC_SERVICE *state)
fcntl(exclusive_fd, F_SETFD,
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
- if (*state & RC_SERVICE_STOPPED)
- ewarnx("WARNING: %s is already stopped", applet);
+ if (*state & RC_SERVICE_STOPPED) {
+ ewarn("WARNING: %s is already stopped", applet);
+ exit(EXIT_SUCCESS);
+ }
rc_service_mark(service, RC_SERVICE_STOPPING);
hook_out = RC_HOOK_SERVICE_STOP_OUT;