From 0ea308422ca771b7d267ea88fe1e65c048e06185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vivek=20Das=C2=A0Mohapatra?= <vivek@collabora.co.uk> Date: Fri, 12 May 2017 16:44:19 +0100 Subject: [PATCH] Don't search for absolute paths in LD_LIBRARY_PATH style path-lists If a path handed to us was absolute all we need do is trasnpose it to the capsule prefix and look for it there - it makes no sense to do the usual LD_LIBRARY_PATH; /lib/:/usr/lib; ld.so.cache searches for an absolute path. --- capsule/capsule-dlmopen.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/capsule/capsule-dlmopen.c b/capsule/capsule-dlmopen.c index 8ce214570..25f95b354 100644 --- a/capsule/capsule-dlmopen.c +++ b/capsule/capsule-dlmopen.c @@ -508,6 +508,7 @@ dso_find (const char *name, ldlibs_t *ldlibs, int i) { int found = 0; const char *ldpath = NULL; + int absolute = (name && (name[0] == '/')); // absolute path, or relative to CWD: if( strchr( name, '/' ) ) @@ -538,10 +539,14 @@ dso_find (const char *name, ldlibs_t *ldlibs, int i) target = name; } + ldlib_debug( ldlibs, "resolving path %s", target ); if( realpath( target, ldlibs->needed[i].path ) ) return ldlib_open( ldlibs, name, i ); } + if( absolute ) + return 0; + if( (ldpath = getenv( "LD_LIBRARY_PATH" )) ) if( (found = search_ldpath( name, ldpath, ldlibs, i )) ) return found; -- GitLab