commit:     a59365a582c3a8c9a8b863b572fddcb65fccadfd
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Fri Oct  2 21:34:15 2015 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Oct  2 21:34:15 2015 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a59365a5

start-stop-daemon.sh: complain in start if command is undefined

The default start-stop-daemon start function expects the command
variable to be defined to point to the daemon we want to start.

If the variable is undefined, this means that there will be nothing to
start, and in this case we should complain because it is possible that
the script writer made a typo in the variable name.

 sh/start-stop-daemon.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/sh/start-stop-daemon.sh b/sh/start-stop-daemon.sh
index 6a3e205..ea99269 100644
--- a/sh/start-stop-daemon.sh
+++ b/sh/start-stop-daemon.sh
@@ -4,7 +4,13 @@
 
 ssd_start()
 {
-       [ -n "$command" ] || return 0
+       if [ -z "$command" ]; then
+               ewarn "The command variable is undefined."
+               ewarn "There is nothing for ${name:-$RC_SVCNAME} to start."
+               ewarn "If this is what you intend, please write a start 
function."
+               ewarn "This will become a failure in a future release."
+               return 0
+       fi
 
        local _background=
        ebegin "Starting ${name:-$RC_SVCNAME}"

Reply via email to