qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [V6 PATCH 4/9] virtio-9p: Add qemu side interfaces for


From: M. Mohan Kumar
Subject: [Qemu-devel] Re: [V6 PATCH 4/9] virtio-9p: Add qemu side interfaces for chroot environment
Date: Thu, 3 Mar 2011 19:31:21 +0530
User-agent: KMail/1.13.5 (Linux/2.6.35.10-74.fc14.i686.PAE; KDE/4.5.4; i686; ; )

On Thursday 03 March 2011 5:08:10 pm Stefan Hajnoczi wrote:
> On Mon, Feb 28, 2011 at 11:22 AM, M. Mohan Kumar <address@hidden> wrote:
> > +    retval = recvmsg(sockfd, &msg, 0);
> > +    if (retval < 0) {
> > +        *sock_error = 1;
> > +        return -EIO;
> > +    }
> 
> Are we guaranteed this will be called with signals blocked?  Otherwise
> we need to handle EINTR.

Ok

> 
> > +    if (fd_info.fi_flags & FI_FD_SOCKERR) {
> > +        *sock_error = 1;
> > +        return -EIO;
> > +    }
> > +    /* If fd is invalid, ancillary data is not present */
> > +    if (fd_info.fi_fd < 0 || fd_info.fi_flags & FI_FD_INVALID) {
> > +        return fd_info.fi_fd;
> > +    }
> 
> Testing fd_info.fi_flags & FI_FD_INVALID looks dangerous to me.  If
> for some reason fi_fd >= 0 then we'd return success here.  fd_fd < 0
> should be a sufficient check, perhaps you wanted an assert() instead?

This check is required because,

Creating special objects like directory, device nodes will not have a valid 
fd, usually fd will be 0 on success and -ve on error. During success cases, we 
can't do sendmsg for fd=0 value with SCM_RIGHTS, that would result in problem. 
In this case, we set fd_info.fi_flags to FI_FD_INVALID indicating fd is not a 
valid one, but its not an error case also.
 
----
M. Mohan Kumar



reply via email to

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