aboutsummaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-14 11:55:17 +0200
committerBrian Behlendorf <[email protected]>2021-05-20 08:54:47 -0700
commit2ca77988a5584440b9d322ebb26ab55c730637bf (patch)
tree06e18642bd5e76503e5f09f591443d348f6dda01 /etc
parent1d106ab57a53dced72d0798c62635f11b8242bd1 (diff)
Fix SC2181 ("[ $?") outside tests/
Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12042
Diffstat (limited to 'etc')
-rwxr-xr-xetc/init.d/zfs-zed.in22
-rw-r--r--etc/zfs/zfs-functions.in12
2 files changed, 16 insertions, 18 deletions
diff --git a/etc/init.d/zfs-zed.in b/etc/init.d/zfs-zed.in
index 6af9ee60c..8890a7122 100755
--- a/etc/init.d/zfs-zed.in
+++ b/etc/init.d/zfs-zed.in
@@ -61,20 +61,16 @@ do_stop()
check_module_loaded "zfs" || exit 0
zfs_action "Stopping ZFS Event Daemon" zfs_daemon_stop \
- "$ZED_PIDFILE" "$ZED" "$ZED_NAME"
- if [ "$?" -eq "0" ]
+ "$ZED_PIDFILE" "$ZED" "$ZED_NAME" || return "$?"
+
+ # Let's see if we have any pools imported
+ pools=$("$ZPOOL" list -H -oname)
+ if [ -z "$pools" ]
then
- # Let's see if we have any pools imported
- pools=$("$ZPOOL" list -H -oname)
- if [ -z "$pools" ]
- then
- # No pools imported, it is/should be safe/possible to
- # unload modules.
- zfs_action "Unloading modules" rmmod zfs zunicode \
- zavl zcommon znvpair zlua spl
- return "$?"
- fi
- else
+ # No pools imported, it is/should be safe/possible to
+ # unload modules.
+ zfs_action "Unloading modules" rmmod zfs zunicode \
+ zavl zcommon znvpair zlua spl
return "$?"
fi
}
diff --git a/etc/zfs/zfs-functions.in b/etc/zfs/zfs-functions.in
index 54f2ebc0e..dbe131732 100644
--- a/etc/zfs/zfs-functions.in
+++ b/etc/zfs/zfs-functions.in
@@ -182,15 +182,17 @@ zfs_daemon_stop()
# LSB functions
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 \
--pidfile "$PIDFILE" --name "$DAEMON_NAME"
- [ "$?" = 0 ] && rm -f "$PIDFILE"
+ ret="$?"
+ [ "$ret" = 0 ] && rm -f "$PIDFILE"
- return $?
+ return "$ret"
elif type killproc > /dev/null 2>&1 ; then
# Fedora/RedHat functions
killproc -p "$PIDFILE" "$DAEMON_NAME"
- [ "$?" = 0 ] && rm -f "$PIDFILE"
+ ret="$?"
+ [ "$ret" = 0 ] && rm -f "$PIDFILE"
- return $?
+ return "$ret"
else
# Unsupported
return 3
@@ -371,7 +373,7 @@ in_mtab()
local mntpnt="$1"
# Remove 'unwanted' characters.
mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
- -e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
+ -e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')
local var
var="$(eval echo MTAB_$mntpnt)"