From 542a56ebb908398643f0128a6b7b637e88f82f1d Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 5 Apr 2016 13:41:13 -0700 Subject: [PATCH 1/3] uwrap: Attempt to dlopen libc.so.*.1 as a fallback. glibc on Alpha and IA64 is libc.so.6.1. Without this, uwrap.libc.handle is set to RTLD_NEXT, leading to a segmentation fault in the unit tests when dlclose() is called. Signed-off-by: Matt Turner --- src/uid_wrapper.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/uid_wrapper.c b/src/uid_wrapper.c index 743d590..c71bc28 100644 --- a/src/uid_wrapper.c +++ b/src/uid_wrapper.c @@ -402,7 +402,14 @@ static void *uwrap_load_lib_handle(enum uwrap_lib lib) for (i = 10; i >= 0; i--) { char soname[256] = {0}; - snprintf(soname, sizeof(soname), "libc.so.%d", i); + snprintf(soname, sizeof(soname) - 2, "libc.so.%d", i); + handle = dlopen(soname, flags); + if (handle != NULL) { + break; + } + + /* glibc on Alpha and IA64 is libc.so.6.1 */ + strcat(soname, ".1"); handle = dlopen(soname, flags); if (handle != NULL) { break; -- 2.7.3