Browse Source

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.
Rich Felker 11 năm trước cách đây
mục cha
commit
3e3753c1a8
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/ldso/dynlink.c

+ 2 - 2
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;