handle library paths better (ignore empty path components, etc.)
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 56ba89e..472e389 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -208,15 +208,17 @@
static int path_open(const char *name, const char *search)
{
char buf[2*NAME_MAX+2];
- const char *s, *z;
+ const char *s=search, *z;
int l, fd;
- for (s=search; *s; s+=l+!!z) {
+ for (;;) {
+ while (*s==':') s++;
+ if (!*s) return -1;
z = strchr(s, ':');
l = z ? z-s : strlen(s);
snprintf(buf, sizeof buf, "%.*s/%s", l, s, name);
if ((fd = open(buf, O_RDONLY))>=0) return fd;
+ s += l;
}
- return -1;
}
static struct dso *load_library(const char *name)