diff options
author | наб <[email protected]> | 2021-05-14 11:55:17 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-06-08 14:45:03 -0700 |
commit | 59d91b4d10bac7597cb21394080b3f33b84e184a (patch) | |
tree | cb36445604228978f12ca96ec3607bb86eea8006 /cmd/zed | |
parent | d53a6969c106cc06a8064dabc3161364e7e04ba9 (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')
-rw-r--r-- | cmd/zed/zed.d/zed-functions.sh | 8 |
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 1fd388862..e809241de 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}>&-" |