Fix SC2181 issues in kdump-udev-throttler

Resolves: https://issues.redhat.com/browse/RHEL-104940
Conflict: .github/workflows/main.yml only exists upstream

commit e25009be073adcf00885d42c5ae3856b49ce7188
Author: Coiby Xu <coxu@redhat.com>
Date:   Wed Jul 23 13:32:42 2025 +0800

    Fix SC2181 issues in kdump-udev-throttler

    Fix the issues found by shellcheck,

      In kdump-udev-throttler line 30:
      if [ $? -ne 0 ]; then
           ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.

      In kdump-udev-throttler line 37:
      if [ $? -ne 0 ]; then
           ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.

    Also add kdump-udev-throttler to shellcheck list for Github Action.

    Signed-off-by: Coiby Xu <coxu@redhat.com>

Signed-off-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Coiby Xu 2025-10-09 16:52:06 +08:00
parent 549f7befa4
commit 8a045edc52

View File

@ -26,15 +26,14 @@ unuse_luks_keys()
[[ -f $LUKS_CONFIGFS_REUSE ]] || echo 0 > $LUKS_CONFIGFS_REUSE
}
exec 9> $throttle_lock
if [ $? -ne 0 ]; then
if ! exec 9> $throttle_lock; then
echo "Failed to create the lock file! Fallback to non-throttled kdump service restart"
/bin/kdumpctl reload
exit 1
fi
flock -n 9
if [ $? -ne 0 ]; then
if ! flock -n 9; then
echo "Throttling kdump restart for concurrent udev event"
exit 0
fi