From 59d91b4d10bac7597cb21394080b3f33b84e184a Mon Sep 17 00:00:00 2001 From: наб Date: Fri, 14 May 2021 11:55:17 +0200 Subject: Fix SC2181 ("[ $?") outside tests/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: John Kennedy Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #12042 --- cmd/zed/zed.d/zed-functions.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'cmd/zed') 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}>&-" -- cgit v1.2.3