[U-Boot] [patch] replace mkimage.c write() calls with full_write()

Andrew Cann shum at canndrew.org
Thu Mar 20 04:44:08 CET 2014


This patch adds a function to mkimage.c called full_write() which calls write()
in a loop until all the data has been written or write errors.

I was getting an error with mkimage running out of space on the device it was
writing to, but instead of printing a useful error message it was printing:

    mkimage: Write error on /tmp/flash.img: Success

Which is kinda confusing. It was printing this because write() was writing as
many bytes as it could and then returning success. It needs to be called a
second time to set errno. Also write(fd, data, count) isn't guranteed to write
the full count bytes in one go anyway, so it needs to be called in a loop (that
or use fwrite instead).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: u-boot-mkimage.patch
Type: text/x-diff
Size: 2454 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140320/f008d933/attachment.patch>


More information about the U-Boot mailing list