From 41da0a2924d11b23a3f8d34efddf2ee39f6b9204 Mon Sep 17 00:00:00 2001 From: Gordon Messmer Date: Wed, 1 Feb 2023 00:24:17 -0800 Subject: [PATCH] Resolve symlinks when gathering libtool version. --- tools/elfdeps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/elfdeps.c b/tools/elfdeps.c index b54e7a009a..0e37a248a1 100644 --- a/tools/elfdeps.c +++ b/tools/elfdeps.c @@ -44,7 +44,15 @@ typedef struct elfInfo_s { static char *getLibtoolVer(const char *filename) { const char *so; + char dest[PATH_MAX]; + int destsize = 0; int found_digit, found_dot = 0; + + destsize = readlink(filename, dest, PATH_MAX); + if (destsize > 0) { + dest[destsize] = 0; + filename = dest; + } // Start from the end of the string. Verify that it ends with // numbers and dots, preceded by ".so.". so = filename + strlen(filename);