Skip to content
Commit 1c9a4be5 authored by Alexander Kapshuk's avatar Alexander Kapshuk Committed by Greg Kroah-Hartman
Browse files

ver_linux: Drop redundant calls to system() to test if file is readable



Running 'test -r' on an awk variable name whose value is an empty
string results in test being run with no arguments, and causes system()
to return 0, which indicates success when used to test values returned
by function calls. This results in code within the if blocks being run
when it should not be.
Instead of testing if a file is accessible and readable via calls to
system("test -r " file), rely on the value returned by getline to perform
this kind of testing. Getline returns -1 on error, with the code within
the while loops not being run.

Signed-off-by: default avatarAlexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4169bc43
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment