Skip to content

Commit

Permalink
libcextract: ArgvParser: Use basename instead of std::filename
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
marcosps authored and giulianobelinassi committed Aug 22, 2024
1 parent c69e9ff commit 54c6203
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libcextract/ArgvParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

#include <clang/Basic/Version.h>

#include <filesystem>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
/* Use the basename version that doesn't change the input string */
#include <string.h>

#ifndef CLANG_VERSION_MAJOR
# error "Unable to find clang version"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 54c6203

Please sign in to comment.