Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so Fix linked-list botch with sysctl-based li...



details:   https://anonhg.NetBSD.org/src/rev/feb734ccd494
branches:  trunk
changeset: 499086:feb734ccd494
user:      simonb <simonb%NetBSD.org@localhost>
date:      Fri Nov 10 18:19:06 2000 +0000

description:
Fix linked-list botch with sysctl-based library selection that meant
only the last line was used.  Allow more than one white space character
between fields.

Reviewed by Christos Zoulas.

diffstat:

 libexec/ld.elf_so/paths.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (45 lines):

diff -r f250498e747d -r feb734ccd494 libexec/ld.elf_so/paths.c
--- a/libexec/ld.elf_so/paths.c Fri Nov 10 18:15:57 2000 +0000
+++ b/libexec/ld.elf_so/paths.c Fri Nov 10 18:19:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: paths.c,v 1.13 2000/11/09 23:14:21 simonb Exp $         */
+/*     $NetBSD: paths.c,v 1.14 2000/11/10 18:19:06 simonb Exp $         */
 
 /*
  * Copyright 1996 Matt Thomas <matt%3am-software.com@localhost>
@@ -216,7 +216,10 @@
        memset(hwptr, 0, sizeof(*hwptr));
        hwptr->name = xstrdup(ptr);
 
-       if ((ptr = strsep(&bp, WS)) == NULL) {
+       while ((ptr = strsep(&bp, WS)) != NULL)
+               if (*ptr != '\0')
+                       break;
+       if (ptr == NULL) {
                xwarnx("missing sysctl variable name");
                goto cleanup;
        }
@@ -258,6 +261,11 @@
                            hwptr->ctltype[i]));
 
        for (i = 0; (ptr = strsep(&bp, WS)) != NULL; i++) {
+               if (*ptr == '\0') {
+                       /* back up index and continue */
+                       i--;
+                       continue;
+               }
                if (i == RTLD_MAX_ENTRY) {
 no_more:
                        xwarnx("maximum library entries exceeded `%s'",
@@ -311,10 +319,7 @@
                goto cleanup;
        }
 
-
-       hwptr->next = NULL;
-       if (*lib_p != NULL)
-               (*lib_p)->next = hwptr;
+       hwptr->next = *lib_p;
        *lib_p = hwptr;
 
        return;



Home | Main Index | Thread Index | Old Index