diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-04 18:27:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-04 18:27:08 +0000 |
commit | 18423be53229bf49c861cdd4941144cdb72d7585 (patch) | |
tree | 635fb7454734dd6cc4edb70af296f8aa35a7b909 /usr.bin/nm | |
parent | 6a57d843026de39c058049581e39c330a1894439 (diff) |
check MID field like strip(1) does; PR#149, mickey; fix by me
Diffstat (limited to 'usr.bin/nm')
-rw-r--r-- | usr.bin/nm/nm.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c index 26b14601265..2cd5559707f 100644 --- a/usr.bin/nm/nm.c +++ b/usr.bin/nm/nm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nm.c,v 1.4 1997/01/15 23:42:59 millert Exp $ */ +/* $OpenBSD: nm.c,v 1.5 1997/04/04 18:27:07 deraadt Exp $ */ /* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */ /* @@ -47,9 +47,10 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)nm.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: nm.c,v 1.4 1997/01/15 23:42:59 millert Exp $"; +static char rcsid[] = "$OpenBSD: nm.c,v 1.5 1997/04/04 18:27:07 deraadt Exp $"; #endif /* not lint */ +#include <sys/param.h> #include <sys/types.h> #include <a.out.h> #include <stab.h> @@ -173,7 +174,12 @@ process_file(fname) rewind(fp); /* this could be an archive */ - if (N_BADMAG(exec_head)) { +#if (MID_MACHINE == MID_M68K) + if (N_BADMAG(exec_head) || ((N_GETMID(exec_head) != MID_MACHINE) && + (N_GETMID(exec_head) != MID_M68K4K))) { +#else + if (N_BADMAG(exec_head) || N_GETMID(exec_head) != MID_MACHINE) { +#endif if (fread(magic, sizeof(magic), (size_t)1, fp) != 1 || strncmp(magic, ARMAG, SARMAG)) { warnx("%s: not object file or archive", fname); |