提交 afe90179 编写于 作者: A Alexander Kapshuk 提交者: Greg Kroah-Hartman

ver_linux: Eliminate duplicate code in ldconfig processing logic

The code that acquires the version strings for libc and libcpp is
identical, as is the printversion call. The only difference being the
name of the library being printed.

Refactor the code by unifying the bits that are common to both libraries.
Signed-off-by: NAlexander Kapshuk <alexander.kapshuk@gmail.com>
Link: https://lore.kernel.org/r/20210108112626.8623-1-alexander.kapshuk@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 d0259c42
......@@ -15,7 +15,7 @@ BEGIN {
vernum = "[0-9]+([.]?[0-9]+)+"
libc = "libc[.]so[.][0-9]+$"
libcpp = "(libg|stdc)[+]+[.]so[.][0-9]+$"
libcpp = "(libg|stdc)[+]+[.]so([.][0-9]+)+$"
printversion("GNU C", version("gcc -dumpversion"))
printversion("GNU Make", version("make --version"))
......@@ -37,12 +37,10 @@ BEGIN {
printversion("Bison", version("bison --version"))
printversion("Flex", version("flex --version"))
while ("ldconfig -p 2>/dev/null" | getline > 0) {
if ($NF ~ libc && !seen[ver = version("readlink " $NF)]++)
printversion("Linux C Library", ver)
else if ($NF ~ libcpp && !seen[ver = version("readlink " $NF)]++)
printversion("Linux C++ Library", ver)
}
while ("ldconfig -p 2>/dev/null" | getline > 0)
if ($NF ~ libc || $NF ~ libcpp)
if (!seen[ver = version("readlink " $NF)]++)
printversion("Linux C" ($NF ~ libcpp? "++" : "") " Library", ver)
printversion("Dynamic linker (ldd)", version("ldd --version"))
printversion("Procps", version("ps --version"))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册