diff options
author | marcel <marcel@FreeBSD.org> | 2014-05-21 17:38:14 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2014-05-21 17:38:14 +0000 |
commit | b67182258cc019665f2101854e10a428d13b5995 (patch) | |
tree | e4c432509f610786f80a4fcecb3b0582641c8c91 /usr.bin/mkimg | |
parent | f845ed23755391f815afb35685d8d38f0d0b654e (diff) | |
download | FreeBSD-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.c | 6 |
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); } |