diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-08-23 17:48:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-08-23 17:48:03 +0000 |
commit | 0a3dd5325e37bae0312147a85dbfb494e9e87a1f (patch) | |
tree | 249c01538ae25c25571a59e8e8ad44c3ba8e0979 /lib/libc/gen | |
parent | 4b0c0ed86dff159ea10eadabbedaf00eec3e9845 (diff) |
Strip leading '_' from symbol to lookup if symbols in file lack leading '_'.
Needed to make nlist of /dev/ksyms work correctly on non-a.out kernels.
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/nlist.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c index bccf20e5db4..5ae1b965591 100644 --- a/lib/libc/gen/nlist.c +++ b/lib/libc/gen/nlist.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: nlist.c,v 1.26 1998/08/21 20:33:12 millert Exp $"; +static char rcsid[] = "$OpenBSD: nlist.c,v 1.27 1998/08/23 17:48:02 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -130,8 +130,12 @@ __aout_fdnlist(fd, list) if (s->n_un.n_strx == 0 || (s->n_type & N_STAB) != 0) continue; - for (p = list; !ISLAST(p); p++) - if (!strcmp(sname, p->n_un.n_name)) { + for (p = list; !ISLAST(p); p++) { + char *pname = p->n_un.n_name; + + if (*sname != '_' && *pname == '_') + pname++; + if (!strcmp(sname, pname)) { p->n_value = s->n_value; p->n_type = s->n_type; p->n_desc = s->n_desc; @@ -139,6 +143,7 @@ __aout_fdnlist(fd, list) if (--nent <= 0) break; } + } } } free(strtab); |