]> code.ossystems Code Review - openembedded-core.git/commitdiff
bluez5: Fix status subcommand of init script
authorDavid Frey <dpfrey@gmail.com>
Thu, 10 Jan 2019 19:23:52 +0000 (11:23 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 14 Jan 2019 11:21:58 +0000 (11:21 +0000)
Update the bluez5 init script to resolve an issue where the status
subcommand would exit without printing any message if bluez was not
running. The early exit was caused by the fact that the init script has
"set -e". When "pidof ${DAEMON} >/dev/null" is executed, the script
terminates immediately if bluez isn't running because pidof returns a
non-zero result. The fixed version does not suffer from this issue and
makes use of the "status" function from the functions library.

Signed-off-by: David Frey <dpfrey@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-connectivity/bluez5/bluez5/init

index d7972f2d950bdc81aed298bc469208b558f5c8dd..ca9fa18549984fad605e9b2761e285c710020707 100644 (file)
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+# Source function library
+. /etc/init.d/functions
+
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 DESC=bluetooth
 
@@ -44,14 +47,7 @@ case $1 in
        $0 start
   ;;
   status)
-        pidof ${DAEMON} >/dev/null
-        status=$?
-        if [ $status -eq 0 ]; then
-                 echo "bluetooth is running."
-        else
-                echo "bluetooth is not running"
-        fi
-        exit $status
+       status ${DAEMON} || exit $?
    ;;
    *)
        N=/etc/init.d/bluetooth