Skip to content

Commit

Permalink
ver_linux: Process input coming from procmaps that matches libc only
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexander Kapshuk authored and Greg Kroah-Hartman committed Jul 7, 2018
1 parent ce05454 commit 34fe3cf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/ver_linux
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 34fe3cf

Please sign in to comment.