mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] ver_linux: Process input coming from procmaps that matches libc only
@ 2018-05-31 19:22 Alexander Kapshuk
  2018-05-31 19:22 ` [PATCH 2/2] ver_linux: Do not check for ver_linux pattern in version function Alexander Kapshuk
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kapshuk @ 2018-05-31 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh, alexander.kapshuk

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>
---
 scripts/ver_linux | 12 +++++++-----
 1 file 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
+			}
 		}
 	}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-31 19:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 19:22 [PATCH 1/2] ver_linux: Process input coming from procmaps that matches libc only Alexander Kapshuk
2018-05-31 19:22 ` [PATCH 2/2] ver_linux: Do not check for ver_linux pattern in version function Alexander Kapshuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®