Fix SC2181 ("[ $?") outside tests/

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12042
This commit is contained in:
наб
2021-05-14 11:55:17 +02:00
committed by Brian Behlendorf
parent 1d106ab57a
commit 2ca77988a5
11 changed files with 29 additions and 52 deletions
+9 -13
View File
@@ -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
}
+7 -5
View File
@@ -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)"