summaryrefslogtreecommitdiffstats
path: root/sbin/ldconfig
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1996-02-26 02:22:33 +0000
committerpst <pst@FreeBSD.org>1996-02-26 02:22:33 +0000
commiteafacc8e847963309041e7bfbcefd38f7b6dbca3 (patch)
tree4427972615ff4be032561d5769a52e7a4f659408 /sbin/ldconfig
parentaa44f1d542a1529cd1b734fe456860538f8ae98a (diff)
downloadFreeBSD-src-eafacc8e847963309041e7bfbcefd38f7b6dbca3.zip
FreeBSD-src-eafacc8e847963309041e7bfbcefd38f7b6dbca3.tar.gz
Bring in some of Paul K's fixes for ldconfig from NetBSD-current.
This solves the problem of being unable to use shared libraries with dots in their names before the ".so.<version>" code. This should be brought into -stable. There are more changes from Paul that look like they should be included, but they change the format of the hints file, so I'm not going to bring them in now (but we should in the future). Obtained from: pk@netbsd.org
Diffstat (limited to 'sbin/ldconfig')
-rw-r--r--sbin/ldconfig/ldconfig.c40
1 files changed, 30 insertions, 10 deletions
diff --git a/sbin/ldconfig/ldconfig.c b/sbin/ldconfig/ldconfig.c
index 1b3f8f2..13cd297 100644
--- a/sbin/ldconfig/ldconfig.c
+++ b/sbin/ldconfig/ldconfig.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1993 Paul Kranenburg
+ * Copyright (c) 1993,1995 Paul Kranenburg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
* (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: ldconfig.c,v 1.10 1995/06/24 10:08:44 asami Exp $
+ * $Id: ldconfig.c,v 1.13 1996/01/09 00:04:35 pk Exp $
*/
#include <sys/param.h>
@@ -139,7 +139,7 @@ int silent;
{
DIR *dd;
struct dirent *dp;
- char name[MAXPATHLEN], rest[MAXPATHLEN];
+ char name[MAXPATHLEN];
int dewey[MAXDEWEY], ndewey;
if ((dd = opendir(dir)) == NULL) {
@@ -149,17 +149,38 @@ int silent;
}
while ((dp = readdir(dd)) != NULL) {
- int n;
+ register int n;
+ register char *cp;
- name[0] = rest[0] = '\0';
+ /* Check for `lib' prefix */
+ if (dp->d_name[0] != 'l' ||
+ dp->d_name[1] != 'i' ||
+ dp->d_name[2] != 'b')
+ continue;
+
+ /* Copy the entry minus prefix */
+ (void)strcpy(name, dp->d_name + 3);
+ n = strlen(name);
+ if (n < 4)
+ continue;
- n = sscanf(dp->d_name, "lib%[^.].so.%s",
- name, rest);
+ /* Find ".so." in name */
+ for (cp = name + n - 4; cp > name; --cp) {
+ if (cp[0] == '.' &&
+ cp[1] == 's' &&
+ cp[2] == 'o' &&
+ cp[3] == '.')
+ break;
+ }
+ if (cp <= name)
+ continue;
- if (n < 2 || rest[0] == '\0')
+ *cp = '\0';
+ if (!isdigit(*(cp+4)))
continue;
- ndewey = getdewey(dewey, rest);
+ bzero((caddr_t)dewey, sizeof(dewey));
+ ndewey = getdewey(dewey, cp + 4);
enter(dir, dp->d_name, name, dewey, ndewey);
}
@@ -450,4 +471,3 @@ listhints()
return;
}
-
OpenPOWER on IntegriCloud