aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/mkimg
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2014-05-21 17:37:22 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2014-05-21 17:37:22 +0000
commita513818762a58a7bc29d04c2a41a3903485469c2 (patch)
tree62fbd9d5ba3a8e9aebb4759145111435d23abee1 /usr.bin/mkimg
parent9746454f547f68c540d41228064207658cc1697e (diff)
downloadsrc-a513818762a58a7bc29d04c2a41a3903485469c2.tar.gz
src-a513818762a58a7bc29d04c2a41a3903485469c2.zip
Fix CID 1215125: fstat(2) returns -1 on error and sets errno. It does
not return the error (oops).
Notes
Notes: svn path=/head/; revision=266511
Diffstat (limited to 'usr.bin/mkimg')
-rw-r--r--usr.bin/mkimg/scheme.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.bin/mkimg/scheme.c b/usr.bin/mkimg/scheme.c
index 79312effac26..7546ae289f34 100644
--- a/usr.bin/mkimg/scheme.c
+++ b/usr.bin/mkimg/scheme.c
@@ -103,14 +103,12 @@ int
scheme_bootcode(int fd)
{
struct stat sb;
- int error;
if (scheme->bootcode == 0)
return (ENXIO);
- error = fstat(fd, &sb);
- if (error)
- return (error);
+ if (fstat(fd, &sb) == -1)
+ return (errno);
if (sb.st_size > scheme->bootcode)
return (EFBIG);