Commit 34fe3cfd authored by Alexander Kapshuk's avatar Alexander Kapshuk Committed by Greg Kroah-Hartman

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: default avatarAlexander Kapshuk <alexander.kapshuk@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ce054546
...@@ -32,11 +32,13 @@ BEGIN { ...@@ -32,11 +32,13 @@ BEGIN {
printversion("Nfs-utils", version("showmount --version")) printversion("Nfs-utils", version("showmount --version"))
while (getline <"/proc/self/maps" > 0) { while (getline <"/proc/self/maps" > 0) {
n = split($0, procmaps, "/") if (/libc.*\.so$/) {
if (/libc.*so$/ && match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { n = split($0, procmaps, "/")
ver = substr(procmaps[n], RSTART, RLENGTH) if (match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) {
printversion("Linux C Library", ver) ver = substr(procmaps[n], RSTART, RLENGTH)
break printversion("Linux C Library", ver)
break
}
} }
} }
......
Markdown is supported
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