Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/sbin/ldconfig Pull up revisions 1.28-1.29 (requested by...
details: https://anonhg.NetBSD.org/src/rev/05cf991f9a51
branches: netbsd-1-4
changeset: 470631:05cf991f9a51
user: he <he%NetBSD.org@localhost>
date: Thu Jun 01 17:43:42 2000 +0000
description:
Pull up revisions 1.28-1.29 (requested by matt):
Enable searching for libraries under /emul/aout, and make sure
that ELF libraries are not erroneously accepted.
diffstat:
sbin/ldconfig/ldconfig.c | 21 ++++++++++++++++++---
1 files changed, 18 insertions(+), 3 deletions(-)
diffs (56 lines):
diff -r 5d32f2e25522 -r 05cf991f9a51 sbin/ldconfig/ldconfig.c
--- a/sbin/ldconfig/ldconfig.c Thu Jun 01 17:37:12 2000 +0000
+++ b/sbin/ldconfig/ldconfig.c Thu Jun 01 17:43:42 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ldconfig.c,v 1.22.2.1 1999/10/20 23:15:02 he Exp $ */
+/* $NetBSD: ldconfig.c,v 1.22.2.2 2000/06/01 17:43:42 he Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@
#include <sys/file.h>
#include <sys/time.h>
#include <sys/mman.h>
+#include <a.out.h>
#include <ctype.h>
#include <dirent.h>
#include <err.h>
@@ -174,7 +175,7 @@
}
while ((line = fgetln(conf, &len)) != NULL) {
- if (*line == '#' || *line == '\n')
+ if (*line != '/')
continue;
if (line[len-1] == '\n') {
@@ -232,7 +233,9 @@
while ((dp = readdir(dd)) != NULL) {
int n;
- char *cp;
+ char *cp, *path;
+ FILE *fp;
+ struct exec ex;
/* Check for `lib' prefix */
if (dp->d_name[0] != 'l' ||
@@ -257,6 +260,18 @@
if (cp <= name)
continue;
+ path = concat(dir, "/", dp->d_name);
+ fp = fopen(path, "r");
+ free(path);
+ if (fp == NULL)
+ continue;
+ n = fread(&ex, 1, sizeof(ex), fp);
+ fclose(fp);
+ if (n != sizeof(ex)
+ || N_GETMAGIC(ex) != ZMAGIC
+ || (N_GETFLAG(ex) & EX_DYNAMIC) == 0)
+ continue;
+
*cp = '\0';
if (!isdigit(*(cp+4)))
continue;
Home |
Main Index |
Thread Index |
Old Index