summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2011-02-06 18:34:00 +0000
committerjasper <jasper@openbsd.org>2011-02-06 18:34:00 +0000
commitb08ed1cf4afab3bf5444c519799dc39d71cddb62 (patch)
tree6f3cbca6b1687c7f7e47bebfb44d9f23ed369b7d
parentIf .Ns is specified on its own line, ignore it, like groff does; (diff)
downloadwireguard-openbsd-b08ed1cf4afab3bf5444c519799dc39d71cddb62.tar.xz
wireguard-openbsd-b08ed1cf4afab3bf5444c519799dc39d71cddb62.zip
- nm -s omitted the symbol list for first object file in an archive. fix this
by forcing show_symtab() to restore its original file offset after processing. fix from pr #6385. ok miod@
-rw-r--r--usr.bin/nm/nm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c
index df77bcde6c4..34e2f521eb3 100644
--- a/usr.bin/nm/nm.c
+++ b/usr.bin/nm/nm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nm.c,v 1.32 2009/10/27 23:51:21 deraadt Exp $ */
+/* $OpenBSD: nm.c,v 1.33 2011/02/06 18:34:00 jasper Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
@@ -354,6 +354,9 @@ show_symtab(off_t off, u_long len, const char *name, FILE *fp)
char *strtab, *p;
int num, rval = 0;
int namelen;
+ off_t restore;
+
+ restore = ftello(fp);
MMAP(symtab, len, PROT_READ, MAP_PRIVATE|MAP_FILE, fileno(fp), off);
if (symtab == MAP_FAILED)
@@ -391,6 +394,8 @@ show_symtab(off_t off, u_long len, const char *name, FILE *fp)
printf("%s in %s\n", strtab, p);
}
+ fseeko(fp, restore, SEEK_SET);
+
free(p);
MUNMAP(symtab, len);
return (rval);
@@ -544,7 +549,6 @@ show_archive(int count, const char *fname, FILE *fp)
} else {
symtaboff = 0;
symtablen = 0;
- goto skip;
}
}