qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: [PATCH] [UPDATED] Add host_device support to qemu-i


From: malc
Subject: Re: [Qemu-devel] Re: [PATCH] [UPDATED] Add host_device support to qemu-img.
Date: Thu, 2 Apr 2009 07:36:43 +0400 (MSD)

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:address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]