aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed.d/zed-functions.sh
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 /cmd/zed/zed.d/zed-functions.sh
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 'cmd/zed/zed.d/zed-functions.sh')
-rw-r--r--cmd/zed/zed.d/zed-functions.sh8
1 files changed, 2 insertions, 6 deletions
diff --git a/cmd/zed/zed.d/zed-functions.sh b/cmd/zed/zed.d/zed-functions.sh
index 73ebd1eea..7c1a7b6ce 100644
--- a/cmd/zed/zed.d/zed-functions.sh
+++ b/cmd/zed/zed.d/zed-functions.sh
@@ -127,9 +127,7 @@ zed_lock()
# Obtain a lock on the file bound to the given file descriptor.
#
eval "exec ${fd}> '${lockfile}'"
- err="$(flock --exclusive "${fd}" 2>&1)"
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ if ! err="$(flock --exclusive "${fd}" 2>&1)"; then
zed_log_err "failed to lock \"${lockfile}\": ${err}"
fi
@@ -165,9 +163,7 @@ zed_unlock()
fi
# Release the lock and close the file descriptor.
- err="$(flock --unlock "${fd}" 2>&1)"
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]; then
+ if ! err="$(flock --unlock "${fd}" 2>&1)"; then
zed_log_err "failed to unlock \"${lockfile}\": ${err}"
fi
eval "exec ${fd}>&-"