qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Stefan Weil <weil@mail.berlios.de>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] raw-posix: Handle errors in raw_create
Date: Tue, 14 Jul 2009 23:32:35 +0200	[thread overview]
Message-ID: <20090714213235.GC7580@lst.de> (raw)
In-Reply-To: <1247323417-17395-1-git-send-email-weil@mail.berlios.de>

On Sat, Jul 11, 2009 at 04:43:37PM +0200, Stefan Weil wrote:
> In qemu-iotests, some large images are created using qemu-img.
> 
> Without checks for errors, qemu-img will just create an
> empty image, and later read / write tests will fail.
> 
> With the patch, failures during image creation are detected
> and reported.

Yeah, we should handle the failures and your patch looks correct in
that respect.  But returning close error codes is in general
not very useful.  There's not much we can do about them, in they
might override the more useful ftruncate error code.

So I'd rather do something like the following:

    if (fd < 0) {
        return -errno;
    }
 
    if (ftruncate(fd, total_size * 512) != 0) {
        result = -errno;
    }

    close(fd);
    return result;

  reply	other threads:[~2009-07-14 21:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 14:43 [Qemu-devel] [PATCH] raw-posix: Handle errors in raw_create Stefan Weil
2009-07-14 21:32 ` Christoph Hellwig [this message]
2009-07-15 16:45   ` Stefan Weil

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=20090714213235.GC7580@lst.de \
    --to=hch@lst.de \
    --cc=qemu-devel@nongnu.org \
    --cc=weil@mail.berlios.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).