diff options
author | Florian Eckert <fe@dev.tdt.de> | 2021-06-15 08:48:18 +0200 |
---|---|---|
committer | Sungbo Eo <mans0n@gorani.run> | 2021-12-04 09:39:11 +0900 |
commit | dd681838d370f1f6f6fa1bf1f22b0414322292f3 (patch) | |
tree | 680c84b80f842a040635dc95a6c40b2774e06387 /package/base-files/files/etc/rc.common | |
parent | c33eb0372e7cbc404eb77a811bca7fe1eed8a2a9 (diff) | |
download | upstream-dd681838d370f1f6f6fa1bf1f22b0414322292f3.tar.gz upstream-dd681838d370f1f6f6fa1bf1f22b0414322292f3.tar.bz2 upstream-dd681838d370f1f6f6fa1bf1f22b0414322292f3.zip |
base-files: fix service_running check
The following command checks if a instance of a service is running.
/etc/init.d/<service> running <instance>
In the variable `$@`, which is passed to the function
`service_running`, the first argument is always the `instance` which
should be checked. Because all other variables where removed from `$@`
with `shift`.
Before this change the first argument of `$@` was set to the `$service`
Variable. So the function does not work as expected. The `$service`
variable was always the instance which should be checked. This is not
what we want.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
Diffstat (limited to 'package/base-files/files/etc/rc.common')
-rwxr-xr-x | package/base-files/files/etc/rc.common | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common index 5dcbf5138d..e950ec209d 100755 --- a/package/base-files/files/etc/rc.common +++ b/package/base-files/files/etc/rc.common @@ -105,9 +105,9 @@ service_data() { } service_running() { - local service="${1:-$(basename $initscript)}" - local instance="${2:-*}" - procd_running "$service" "$instance" "$@" + local instance="${1:-*}" + + procd_running "$(basename $initscript)" "$instance" } ${INIT_TRACE:+set -x} |