diff options
author | P. J. McDermott <pj@pehjota.net> | 2014-06-03 12:39:43 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2014-06-03 12:39:43 (EDT) |
commit | 0a044bae97fbbd9c0a18d8016cdc863297fbf07e (patch) | |
tree | 5fd910e399d13195680f2bdc7ed9532e1f581f2e | |
parent | 3f68144b1905b7be098ffed4de25969a319021c6 (diff) |
/etc/rc.common: Better handle missing action arg.
-rw-r--r-- | src.etc/rc.common | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src.etc/rc.common b/src.etc/rc.common index c6ccf85..8bd589c 100644 --- a/src.etc/rc.common +++ b/src.etc/rc.common @@ -19,7 +19,7 @@ STOP='' main() { - local action="${2}" + local action= local es= SCRIPT="${1}" @@ -31,6 +31,11 @@ main() ALL_CMDS="${ALL_CMDS} enable disable " fi + if [ ${#} -ne 2 ]; then + usage + return 1 + fi + action="${2:-<unknown>}" if [ "x${ALL_CMDS#* ${action} }" != "x${ALL_CMDS}" ]; then if [ "x${action}" = 'xstart' ] && [ -e /etc/rc.policy ]; then [ "x$(cat /etc/rc.policy)" = 'disabled' ] && return 0 |