-/* $OpenBSD: mkuboot.c,v 1.4 2014/05/18 21:18:07 miod Exp $ */
+/* $OpenBSD: mkuboot.c,v 1.5 2015/10/12 05:54:18 deraadt Exp $ */
/*
* Copyright (c) 2008 Mark Kettenis
ifd = open(iname, O_RDONLY);
if (ifd < 0)
err(1, "%s", iname);
+ if (fstat(ifd, &sb) == -1)
+ err(1, "%s", iname);
ofd = open(oname, O_RDWR | O_TRUNC | O_CREAT, 0644);
if (ofd < 0)
err(1, "%s", oname);
- if (stat(iname, &sb) == -1) {
- err(1, "%s", oname);
- }
-
/* Write initial header. */
if (write(ofd, &ih, sizeof ih) != sizeof ih)
err(1, "%s", oname);