qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: malc <av1474@comtv.ru>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH] [UPDATED] Add host_device support to qemu-img.
Date: Thu, 2 Apr 2009 07:36:43 +0400 (MSD)	[thread overview]
Message-ID: <Pine.LNX.4.64.0904020734290.8444@linmac.oyster.ru> (raw)
In-Reply-To: <loom.20090402T031517-364@post.gmane.org>

On Thu, 2 Apr 2009, Nolan wrote:

> malc <av1474 <at> comtv.ru> writes:
> > On Wed, 1 Apr 2009, Nolan wrote:
> 
> <... snip ...>
> 
> > > +    fd = open(filename, O_WRONLY | O_BINARY);
> > > +    if (fd < 0)
> > > +        return -EIO;
> > > +
> > > +    if (fstat(fd, &stat_buf) < 0)
> > > +        ret = -EIO;
> > > +    else if (!S_ISBLK(stat_buf.st_mode))
> > > +        ret = -EIO;
> > > +    else if (lseek(fd, 0, SEEK_END) < total_size * 512)
> > > +        ret = -ENOSPC;
> > 
> > This leaks fescriptors doesn't it, even if only user is qemu-img which
> > just exits on errors this still looks fragile.
> 
> I don't see how.

I should cease trying to read patches at 5:20 in the morning it seems,
you are right ofcourse, sorry for the noise.
 
That said, if fstat/lseek fail the real reason/errno will never be
communicated to the user not directly nor in form of a warning message.

[..snip..]

-- 
mailto:av1474@comtv.ru

  reply	other threads:[~2009-04-02  3:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02  1:07 [Qemu-devel] [PATCH] [UPDATED] Add host_device support to qemu-img Nolan
2009-04-02  1:20 ` malc
2009-04-02  3:18   ` [Qemu-devel] " Nolan
2009-04-02  3:36     ` malc [this message]
2009-04-05 17:43 ` [Qemu-devel] " Anthony Liguori

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=Pine.LNX.4.64.0904020734290.8444@linmac.oyster.ru \
    --to=av1474@comtv.ru \
    --cc=qemu-devel@nongnu.org \
    /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).