summaryrefslogtreecommitdiffstats
path: root/usr.bin/mkimg
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-05-21 17:38:14 +0000
committermarcel <marcel@FreeBSD.org>2014-05-21 17:38:14 +0000
commitb67182258cc019665f2101854e10a428d13b5995 (patch)
treee4c432509f610786f80a4fcecb3b0582641c8c91 /usr.bin/mkimg
parentf845ed23755391f815afb35685d8d38f0d0b654e (diff)
downloadFreeBSD-src-b67182258cc019665f2101854e10a428d13b5995.zip
FreeBSD-src-b67182258cc019665f2101854e10a428d13b5995.tar.gz
Fix CID 1215124: Handle errors properly.
Diffstat (limited to 'usr.bin/mkimg')
-rw-r--r--usr.bin/mkimg/image.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c
index c5a75c9..e92b1f2 100644
--- a/usr.bin/mkimg/image.c
+++ b/usr.bin/mkimg/image.c
@@ -119,8 +119,12 @@ image_copyout(int fd)
}
}
free(buffer);
+ if (error)
+ return (error);
ofs = lseek(fd, 0L, SEEK_CUR);
- ftruncate(fd, ofs);
+ if (ofs == -1)
+ return (errno);
+ error = (ftruncate(fd, ofs) == -1) ? errno : 0;
return (error);
}
OpenPOWER on IntegriCloud