summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-aout/shlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/rtld-aout/shlib.c')
-rw-r--r--libexec/rtld-aout/shlib.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/libexec/rtld-aout/shlib.c b/libexec/rtld-aout/shlib.c
index 9460d35..44e30f0 100644
--- a/libexec/rtld-aout/shlib.c
+++ b/libexec/rtld-aout/shlib.c
@@ -27,28 +27,26 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: shlib.c,v 1.14 1996/01/13 00:14:53 jdp Exp $
+ * $Id: shlib.c,v 1.15 1996/04/20 18:27:56 jdp Exp $
*/
#include <sys/param.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/time.h>
+#include <a.out.h>
+#include <ctype.h>
+#include <dirent.h>
#include <err.h>
#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <a.out.h>
-#include "ld.h"
-
-#ifdef SUNOS4
-char *strsep();
-#endif
+#include <link.h>
+#include "shlib.h"
+#include "support.h"
/*
* Standard directories to search for files specified by -l.
@@ -59,7 +57,7 @@ char *strsep();
/*
* Actual vector of library search directories,
- * including `-L'ed and LD_LIBARAY_PATH spec'd ones.
+ * including `-L'ed and LD_LIBRARY_PATH spec'd ones.
*/
char **search_dirs;
int n_search_dirs;
@@ -73,9 +71,14 @@ void
add_search_dir(name)
char *name;
{
+ int n;
+
+ for (n = 0; n < n_search_dirs; n++)
+ if (strcmp(search_dirs[n], name) == 0)
+ return;
n_search_dirs++;
search_dirs = (char **)
- xrealloc(search_dirs, n_search_dirs * sizeof(char *));
+ xrealloc(search_dirs, n_search_dirs * sizeof search_dirs[0]);
search_dirs[n_search_dirs - 1] = strdup(name);
}
@@ -83,17 +86,16 @@ void
add_search_path(path)
char *path;
{
- register char *cp;
+ register char *cp, *dup;
if (path == NULL)
return;
- /* Add search directories from `paths' */
- while ((cp = strsep(&path, ":")) != NULL) {
+ /* Add search directories from `path' */
+ path = dup = strdup(path);
+ while ((cp = strsep(&path, ":")) != NULL)
add_search_dir(cp);
- if (path)
- *(path-1) = ':';
- }
+ free(dup);
}
void
OpenPOWER on IntegriCloud