tests: fix potentially unbound variable in kernel_version_code

Fix the following use case:

	$ sh -uc '. tests/init.sh; kernel_version_code 4.5'
	tests/init.sh: line 242: 3: unbound variable

* tests/init.sh (kernel_version_code): Fix potentially unbound variable.
This commit is contained in:
Дмитрий Левин 2018-03-23 13:43:13 +00:00
parent 5c0896d9d8
commit 73edd445e2

View File

@ -236,7 +236,7 @@ kernel_version_code()
( (
set -f set -f
IFS=. IFS=.
set -- $1 set -- $1 0 0
v1="${1%%[!0-9]*}" && [ -n "$v1" ] || v1=0 v1="${1%%[!0-9]*}" && [ -n "$v1" ] || v1=0
v2="${2%%[!0-9]*}" && [ -n "$v2" ] || v2=0 v2="${2%%[!0-9]*}" && [ -n "$v2" ] || v2=0
v3="${3%%[!0-9]*}" && [ -n "$v3" ] || v3=0 v3="${3%%[!0-9]*}" && [ -n "$v3" ] || v3=0