eudev: fix error handling init script
authorCarlos Santos <casantos@datacom.ind.br>
Tue, 30 Jan 2018 04:07:18 +0000 (02:07 -0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 30 Jan 2018 21:58:00 +0000 (22:58 +0100)
Replace (echo "msg" && exit 1) by { echo "msg"; exit 1; }.

The (list) compound command runs in a subshell, so the "exit" interrupts
the subshell, not the main script. Examples:

    $ sh -c "echo 1; (exit 1); echo 2"
    1
    2
    $ sh -c "echo 1; { exit 1; }; echo 2"
    1
    $

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/eudev/S10udev

index 8382bec2bbda4e3f1becc36429d9aa802bbfc2ef..654a04df36877af03c986f111602c5b694f0827f 100755 (executable)
@@ -29,7 +29,7 @@ case "$1" in
     start)
         printf "Populating ${udev_root:-/dev} using udev: "
         printf '\000\000\000\000' > /proc/sys/kernel/hotplug
-        $UDEV_BIN -d || (echo "FAIL" && exit 1)
+        $UDEV_BIN -d || { echo "FAIL"; exit 1; }
         udevadm trigger --type=subsystems --action=add
         udevadm trigger --type=devices --action=add
         udevadm settle --timeout=30 || echo "udevadm settle failed"