diff options
author | Alexander Kapshuk <alexander.kapshuk@gmail.com> | 2018-05-31 22:22:46 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-07 17:44:52 +0200 |
commit | 34fe3cfda826e221d15610aa07364384bf8adb94 (patch) | |
tree | e742b33f8d0cb6c8106ac97e412083a52e51f639 | |
parent | ce054546cc2c26891cefa2f284d90d93b52205de (diff) |
ver_linux: Process input coming from procmaps that matches libc only
Currently, input coming from /proc/self/maps is split into fields without
checking whether or not it matches libc.so. This is not efficient.
All text processing should only be performed on lines of input that
match libc.so.
Signed-off-by: Alexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rwxr-xr-x | scripts/ver_linux | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/ver_linux b/scripts/ver_linux index 7227994ccf63..e1dc041f903f 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux @@ -32,11 +32,13 @@ BEGIN { printversion("Nfs-utils", version("showmount --version")) while (getline <"/proc/self/maps" > 0) { - n = split($0, procmaps, "/") - if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { - ver = substr(procmaps[n], RSTART, RLENGTH) - printversion("Linux C Library", ver) - break + if (/libc.*\.so$/) { + n = split($0, procmaps, "/") + if (match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { + ver = substr(procmaps[n], RSTART, RLENGTH) + printversion("Linux C Library", ver) + break + } } } |