From 45c22579bbfdd1533cb15435ac117f775855b3af Mon Sep 17 00:00:00 2001 From: elad Date: Mon, 20 Nov 2006 16:51:44 +0000 Subject: [PATCH] Properly handle 32/64bit headers; from christos@. --- usr.bin/paxctl/paxctl.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/usr.bin/paxctl/paxctl.c b/usr.bin/paxctl/paxctl.c index 4a72ef7ee7ca..890e6bafdd9c 100644 --- a/usr.bin/paxctl/paxctl.c +++ b/usr.bin/paxctl/paxctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: paxctl.c,v 1.7 2006/11/10 21:39:57 christos Exp $ */ +/* $NetBSD: paxctl.c,v 1.8 2006/11/20 16:51:44 elad Exp $ */ /*- * Copyright (c) 2006 Elad Efrat @@ -36,7 +36,7 @@ #include #ifndef lint #ifdef __RCSID -__RCSID("$NetBSD: paxctl.c,v 1.7 2006/11/10 21:39:57 christos Exp $"); +__RCSID("$NetBSD: paxctl.c,v 1.8 2006/11/20 16:51:44 elad Exp $"); #endif #endif /* not lint */ @@ -208,19 +208,14 @@ main(int argc, char **argv) errx(EXIT_FAILURE, "Bad ELF magic from `%s' (maybe it's not an ELF?)", opt); - switch (e.h32.e_ehsize) { - case sizeof(e.h32): + if (e.h32.e_ehsize == sizeof(e.h32)) size = 32; - break; - case sizeof(e.h64): + else if (e.h64.e_ehsize == sizeof(e.h64)) size = 64; - break; - default: + else errx(EXIT_FAILURE, "Bad ELF size %d from `%s' (maybe it's not an ELF?)", (int)e.h32.e_ehsize, opt); - } - for (i = 0; i < EH(e_phnum); i++) { if (pread(fd, &p, PHSIZE,