|
| 1 | +From 1bee26c4d7d787eebbebca2a2ad3c5f3d06528a5 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Aaron Merey <amerey@redhat.com> |
| 3 | +Date: Mon, 27 Oct 2025 21:49:31 -0400 |
| 4 | +Subject: [PATCH] link_map.c: Declare name_no_sysroot only if openat2 |
| 5 | + RESOLVE_IN_ROOT is supported |
| 6 | + |
| 7 | +Rename variable n to name_no_sysroot. Declare name_no_sysroot only if |
| 8 | +openat2 RESOLVE_IN_ROOT is supported to avoid an unused variable warning. |
| 9 | + |
| 10 | +https://sourceware.org/bugzilla/show_bug.cgi?id=33581 |
| 11 | + |
| 12 | +Signed-off-by: Aaron Merey <amerey@redhat.com> |
| 13 | +--- |
| 14 | + libdwfl/link_map.c | 11 +++++++---- |
| 15 | + 1 file changed, 7 insertions(+), 4 deletions(-) |
| 16 | + |
| 17 | +diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c |
| 18 | +index 013a415d..5f934131 100644 |
| 19 | +--- a/libdwfl/link_map.c |
| 20 | ++++ b/libdwfl/link_map.c |
| 21 | +@@ -431,12 +431,14 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, |
| 22 | + |
| 23 | + if (sysroot && !name_in_sysroot) |
| 24 | + { |
| 25 | +- const char *n = NULL; |
| 26 | +- |
| 27 | + if (asprintf (&sysroot_name, "%s%s", sysroot, name) < 0) |
| 28 | + return release_buffer (&memory_closure, &buffer, &buffer_available, -1); |
| 29 | + |
| 30 | +- n = name; |
| 31 | ++#ifdef HAVE_OPENAT2_RESOLVE_IN_ROOT |
| 32 | ++ /* The original name does not contain the sysroot as a prefix. |
| 33 | ++ Save this for use with openat2. */ |
| 34 | ++ const char *name_no_sysroot = name; |
| 35 | ++#endif |
| 36 | + name = sysroot_name; |
| 37 | + |
| 38 | + #ifdef HAVE_OPENAT2_RESOLVE_IN_ROOT |
| 39 | +@@ -451,7 +453,8 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, |
| 40 | + if (sysrootfd < 0) |
| 41 | + return -1; |
| 42 | + |
| 43 | +- fd = syscall (SYS_openat2, sysrootfd, n, &how, sizeof(how)); |
| 44 | ++ fd = syscall (SYS_openat2, sysrootfd, name_no_sysroot, |
| 45 | ++ &how, sizeof(how)); |
| 46 | + err = fd < 0 ? -errno : 0; |
| 47 | + |
| 48 | + close (sysrootfd); |
| 49 | +-- |
| 50 | +2.43.7 |
| 51 | + |
0 commit comments