summaryrefslogtreecommitdiff
path: root/libexec/ld.so/library.c
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2004-10-17 03:56:50 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2004-10-17 03:56:50 +0000
commitb026393a04bbbe5501db2767b3f9383a0a83c462 (patch)
treedca85117ebcad724c4eb3e633929b7e5cd22fb94 /libexec/ld.so/library.c
parent0c189c9f0d3cb7175657e0f523a508c3db65a4e9 (diff)
Fix some problems related to LD_LIBRARY_PATH parsing where it would not
correctly deal with current directory searches specified by "::", ":foo" or "foo:"
Diffstat (limited to 'libexec/ld.so/library.c')
-rw-r--r--libexec/ld.so/library.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c
index aecb3ac9813..2026a8b3af2 100644
--- a/libexec/ld.so/library.c
+++ b/libexec/ld.so/library.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: library.c,v 1.34 2004/07/05 00:47:40 kjell Exp $ */
+/* $OpenBSD: library.c,v 1.35 2004/10/17 03:56:49 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -134,6 +134,12 @@ _dl_find_shlib(struct sod *sodp, const char *searchpath, int nohints)
*path++ = *pp++;
*path = 0;
+ /* interpret "" as curdir "." */
+ if (lp[0] == '\0') {
+ lp[0] = '.';
+ lp[1] = '\0';
+ }
+
hint = _dl_findhint((char *)sodp->sod_name,
sodp->sod_major, sodp->sod_minor, lp);
if (hint != NULL)
@@ -165,6 +171,12 @@ nohints:
*path++ = *pp++;
*path = 0;
+ /* interpret "" as curdir "." */
+ if (lp[0] == '\0') {
+ lp[0] = '.';
+ lp[1] = '\0';
+ }
+
if ((dd = _dl_opendir(lp)) != NULL) {
match = 0;
while ((dp = _dl_readdir(dd)) != NULL) {