diff options
-rw-r--r-- | usr.sbin/mkuboot/mkuboot.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/mkuboot/mkuboot.c b/usr.sbin/mkuboot/mkuboot.c index a3c95b9da31..8ecb79dd790 100644 --- a/usr.sbin/mkuboot/mkuboot.c +++ b/usr.sbin/mkuboot/mkuboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkuboot.c,v 1.3 2013/10/28 09:00:06 patrick Exp $ */ +/* $OpenBSD: mkuboot.c,v 1.4 2014/05/18 21:18:07 miod Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -285,12 +285,10 @@ is_elf(int ifd, const char *iname) nbytes = read(ifd, &ehdr, sizeof ehdr); if (nbytes == -1) err(1, "%s", iname); - if (nbytes != sizeof ehdr) - return 0; - if (lseek(ifd, 0, SEEK_SET) != 0) err(1, "%s", iname); - if (!IS_ELF(ehdr)) + + if (nbytes != sizeof ehdr || !IS_ELF(ehdr)) return 0; if (ehdr.e_ident[EI_CLASS] == ELFCLASS32) |