about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-02 10:02:29 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-02 10:02:29 -0400
commit3e3753c1a8e047dc84f9db1dc26bb046cff457a6 (patch)
tree3f90747be515f613e82ccb85c327da2f2693c8b6
parent78c6d30fd3bb13f5fc6e1ad42675fe5475a87641 (diff)
downloadmusl-3e3753c1a8e047dc84f9db1dc26bb046cff457a6.tar.gz
musl-3e3753c1a8e047dc84f9db1dc26bb046cff457a6.tar.xz
musl-3e3753c1a8e047dc84f9db1dc26bb046cff457a6.zip
move RPATH search after LD_LIBRARY_PATH search
this is the modern way, and the only way that makes any sense. glibc
has this complicated mechanism with RPATH and RUNPATH that controls
whether RPATH is processed before or after LD_LIBRARY_PATH, presumably
to support legacy binaries, but there is no compelling reason to
support this, and better behavior is obtained by just fixing the
search order.
-rw-r--r--src/ldso/dynlink.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index ff99489a..d689f96e 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -517,8 +517,8 @@ static struct dso *load_library(const char *name)
 		}
 		if (strlen(name) > NAME_MAX) return 0;
 		fd = -1;
-		if (r_path) fd = path_open(name, r_path, buf, sizeof buf);
-		if (fd < 0 && env_path) fd = path_open(name, env_path, buf, sizeof buf);
+		if (env_path) fd = path_open(name, env_path, buf, sizeof buf);
+		if (fd < 0 && r_path) fd = path_open(name, r_path, buf, sizeof buf);
 		if (fd < 0) {
 			if (!sys_path) {
 				char *prefix = 0;