]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(load_fstype): use $1 if $2 is missing
authorFrederick Grose <4335897+FGrose@users.noreply.github.com>
Sat, 10 Sep 2022 03:46:29 +0000 (23:46 -0400)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Mon, 26 Sep 2022 09:46:03 +0000 (09:46 +0000)
Use parameter expansion default value if the second argument is missing.
The current code mistakenly reuses the null second argument.

modules.d/99base/dracut-lib.sh

index 2cebbc8ad7a8ad09109d82492cfabcb10bffc7c5..44dd0178a2a7a22cb9e816aa27589d9d5b5991d9 100755 (executable)
@@ -1157,8 +1157,5 @@ remove_hostonly_files() {
 # returns OK if kernel_module is loaded
 # modprobe fails if /lib/modules is not available (--no-kernel use case)
 load_fstype() {
-    if [ -z "$2" ]; then
-        set -- "$1" "$2"
-    fi
-    strstr "$(cat /proc/filesystems)" "$2" || modprobe "$1"
+    strstr "$(cat /proc/filesystems)" "${2:-$1}" || modprobe "$1"
 }