]> git.ipfire.org Git - pakfire.git/commitdiff
stripper: Hack to skip files with no DWARF information
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 25 Oct 2024 12:54:44 +0000 (12:54 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 25 Oct 2024 12:54:44 +0000 (12:54 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/stripper.c

index b867085866b836e9d049777c6c4309f1c4f3ef48..388215adf114ff46461c28d7e0e625d481658624 100644 (file)
@@ -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 (;;) {