All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cann <shum@canndrew.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [patch] replace mkimage.c write() calls with full_write()
Date: Thu, 20 Mar 2014 11:44:08 +0800	[thread overview]
Message-ID: <20140320034408.GA20976@canndrew.org> (raw)

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>

             reply	other threads:[~2014-03-20  3:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20  3:44 Andrew Cann [this message]
2014-03-20 10:35 ` [U-Boot] [patch] replace mkimage.c write() calls with full_write() Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140320034408.GA20976@canndrew.org \
    --to=shum@canndrew.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.