-/* $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
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)