modalias.prov: fix spurious exitcode of 1 on reaching EOF

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
This commit is contained in:
Denys Vlasenko 2023-05-03 11:30:18 +02:00
parent 0c32043719
commit 9d75b962fc

6
modalias.prov Normal file → Executable file
View File

@ -42,7 +42,11 @@ print_modaliases() {
combine_modaliases() { combine_modaliases() {
declare tag class variants="" pos="" n declare tag class variants="" pos="" n
read class
# Due to set -e, we can exit with exitcode 1 on read EOF
# and this makes our caller think we failed. "|| return 0" prevents this:
read class || return 0
while read tag; do while read tag; do
for ((n=0; n<${#class}; n++)); do for ((n=0; n<${#class}; n++)); do
if [ "*" != "${class:n:1}" -a \ if [ "*" != "${class:n:1}" -a \