From: deraadt Date: Fri, 4 Apr 1997 18:27:07 +0000 (+0000) Subject: check MID field like strip(1) does; PR#149, mickey; fix by me X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=bf8fee845d07123b8314544319ed5ac9f6e94b2f;p=openbsd check MID field like strip(1) does; PR#149, mickey; fix by me --- 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 #include #include #include @@ -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);