Skip to content

Commit

Permalink
kdumpct/fadump: fix ShellCheck findings
Browse files Browse the repository at this point in the history
This commit fixes ShellCheck findings introduced by the new feature to
pass additional parameters to the fadump kernel. In particular it fixes
the following

In kdumpctl line 971:
                local output=$( { echo "${FADUMP_COMMANDLINE_APPEND}" > "$FADUMP_APPEND_ARGS_SYS_NODE" ; } 2>&1)
                      ^----^ SC2155 (warning): Declare and assign separately to avoid masking return values.

In kdumpctl line 972:
                if [ $? -eq 0 ]; then
                     ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

Fixes: 53d8e6e ("fadump: fix passing additional parameters for capture kernel")
Fixes: 7b80ce ("fadump: pass additional parameters for capture kernel")
Signed-off-by: Philipp Rudo <[email protected]>
  • Loading branch information
prudo1 authored and coiby committed Dec 10, 2024
1 parent 6f7fbb8 commit e9c84d7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kdumpctl
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,9 @@ check_dump_feasibility()
fadump_bootargs_append()
{
if [[ -f "$FADUMP_APPEND_ARGS_SYS_NODE" ]]; then
local output=$( { echo "${FADUMP_COMMANDLINE_APPEND}" > "$FADUMP_APPEND_ARGS_SYS_NODE" ; } 2>&1)
if [ $? -eq 0 ]; then
local output

if output=$( { echo "${FADUMP_COMMANDLINE_APPEND}" > "$FADUMP_APPEND_ARGS_SYS_NODE" ; } 2>&1); then
output=$(cat "$FADUMP_APPEND_ARGS_SYS_NODE")
dinfo "fadump: additional parameters for capture kernel: '$output'"
else
Expand Down

0 comments on commit e9c84d7

Please sign in to comment.