From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cann Date: Thu, 20 Mar 2014 11:44:08 +0800 Subject: [U-Boot] [patch] replace mkimage.c write() calls with full_write() Message-ID: <20140320034408.GA20976@canndrew.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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: