From fbad8ff36292f3b1e05b768e2f7b9c160309dfca Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Wed, 21 Aug 2024 17:35:30 -0300 Subject: [PATCH] libcextract: ArgvParser: Use basename instead of std::filename The libstdc++ provides on SUSE Linux Enterprise 15 SP6 is too old that it doens't implement the std::filename interface. Using basename avoids this problem. Signed-off-by: Marcos Paulo de Souza --- libcextract/ArgvParser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libcextract/ArgvParser.cpp b/libcextract/ArgvParser.cpp index d22d500..c428aca 100644 --- a/libcextract/ArgvParser.cpp +++ b/libcextract/ArgvParser.cpp @@ -19,7 +19,11 @@ #include -#include +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +/* Use the basename version that doesn't change the input string */ +#include #ifndef CLANG_VERSION_MAJOR # error "Unable to find clang version" @@ -89,7 +93,7 @@ ArgvParser::ArgvParser(int argc, char **argv) * are not the same, it means that the module from PatchObject is builtin, so * assign vmlinux to PatchObject. */ if (Kernel && DebuginfoPath) { - std::string obj_path = std::filesystem::path(DebuginfoPath).filename(); + std::string obj_path = basename(DebuginfoPath); /* As the DebugInfo can point to a file with suffix (btrfs.ko for example), * check the substring */ if (obj_path.find(PatchObject) == std::string::npos)