summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-01-30 23:14:33 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-01-30 23:14:33 +0000
commit17f1728adeba16bf78ea8ddc7300f6e420cc9a2f (patch)
tree41b1d101f2b1164bffd696e31f478f0070a137be /lib/libc
parent0453c3a4f18d5579fd863a8fa1220f6686cbbead (diff)
Fix a logic thinko I made in rev. 1.27. This fixes nlist when
the user passes in a symbol name with an underscore pre-pended on ELF systems.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/nlist.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c
index 16030a9c431..c16def262f4 100644
--- a/lib/libc/gen/nlist.c
+++ b/lib/libc/gen/nlist.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: nlist.c,v 1.46 2003/08/27 17:16:00 mickey Exp $";
+static char rcsid[] = "$OpenBSD: nlist.c,v 1.47 2004/01/30 23:14:32 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -436,9 +436,9 @@ __elf_fdnlist(fd, list)
/*
* First we check for the symbol as it was
- * provided by the user. If that fails,
- * skip the first char if it's an '_' and
- * try again.
+ * provided by the user. If that fails
+ * and the first char is an '_', skip over
+ * the '_' and try again.
* XXX - What do we do when the user really
* wants '_foo' and the are symbols
* for both 'foo' and '_foo' in the
@@ -446,7 +446,7 @@ __elf_fdnlist(fd, list)
*/
sym = p->n_un.n_name;
if (strcmp(&strtab[soff], sym) != 0 &&
- ((sym[0] == '_') &&
+ (sym[0] != '_' ||
strcmp(&strtab[soff], sym + 1) != 0))
continue;