From: Michael Tremer Date: Fri, 25 Oct 2024 12:54:44 +0000 (+0000) Subject: stripper: Hack to skip files with no DWARF information X-Git-Tag: 0.9.30~894 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1457efcdda4c5e8161b9d0df1e89f2262c8b8297;p=pakfire.git stripper: Hack to skip files with no DWARF information Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/stripper.c b/src/libpakfire/stripper.c index b86708586..388215adf 100644 --- a/src/libpakfire/stripper.c +++ b/src/libpakfire/stripper.c @@ -158,6 +158,14 @@ static int pakfire_stripper_copy_source_file( return 0; } +/* + libdw does not seem to export the error codes in their header files, + although there is a function to retrieve them... +*/ +#ifndef DWARF_E_NO_DWARF +#define DWARF_E_NO_DWARF 6 +#endif + static int pakfire_stripper_copy_sources( struct pakfire_ctx* ctx, struct pakfire_file* file, void* data) { struct pakfire_stripper* stripper = data; @@ -184,9 +192,17 @@ static int pakfire_stripper_copy_sources( // Read DWARF information dwarf = dwarf_begin(fileno(f), DWARF_C_READ); if (!dwarf) { - CTX_ERROR(ctx, "Could not initialize DWARF context: %s\n", dwarf_errmsg(-1)); - r = -errno; - goto ERROR; + switch (dwarf_errno()) { + // If we don't have any DWARF information there is nothing to do + case DWARF_E_NO_DWARF: + r = 0; + goto ERROR; + + default: + CTX_ERROR(ctx, "Could not initialize DWARF context: %s\n", dwarf_errmsg(-1)); + r = -errno; + goto ERROR; + } } for (;;) {