summaryrefslogtreecommitdiff
path: root/usr.bin/size/size.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-03 11:16:48 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-09-03 11:16:48 +0000
commite6c27ccd9af1a83d1e6b18c743f3f1a49b0af807 (patch)
tree010636a09e7671276faad33c9b35b503cbb05e51 /usr.bin/size/size.c
parentda9080922a1897fb9d67a61fcf17c17d4570cc89 (diff)
detect wrong architecture
Diffstat (limited to 'usr.bin/size/size.c')
-rw-r--r--usr.bin/size/size.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.bin/size/size.c b/usr.bin/size/size.c
index bd47d1f72f8..8c12930c6d9 100644
--- a/usr.bin/size/size.c
+++ b/usr.bin/size/size.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: size.c,v 1.3 1996/06/26 05:39:18 deraadt Exp $ */
+/* $OpenBSD: size.c,v 1.4 1996/09/03 11:16:47 deraadt Exp $ */
/* $NetBSD: size.c,v 1.7 1996/01/14 23:07:12 pk Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)size.c 8.2 (Berkeley) 12/9/93";
#endif
-static char rcsid[] = "$OpenBSD: size.c,v 1.3 1996/06/26 05:39:18 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: size.c,v 1.4 1996/09/03 11:16:47 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -232,6 +232,11 @@ show_archive(count, fname, fp)
warnx("%s: bad format", name);
rval = 1;
}
+ } else if (N_GETMID(exec_head) != MID_MACHINE) {
+ if (!ignore_bad_archive_entries) {
+ warnx("%s: wrong architecture", name);
+ rval = 1;
+ }
} else {
(void)fseek(fp, (long)-sizeof(exec_head),
SEEK_CUR);
@@ -274,6 +279,11 @@ show_objfile(count, name, fp)
return(1);
}
+ if (N_GETMID(head) != MID_MACHINE) {
+ warnx("%s: wrong architecture", name);
+ return(1);
+ }
+
if (first) {
first = 0;
(void)printf("text\tdata\tbss\tdec\thex\n");