public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [patch] replace mkimage.c write() calls with full_write()
@ 2014-03-20  3:44 Andrew Cann
  2014-03-20 10:35 ` Wolfgang Denk
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cann @ 2014-03-20  3:44 UTC (permalink / raw)
  To: u-boot

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-20 10:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-20  3:44 [U-Boot] [patch] replace mkimage.c write() calls with full_write() Andrew Cann
2014-03-20 10:35 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox