From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3jzA-00084f-3x for qemu-devel@nongnu.org; Thu, 16 Jan 2014 05:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3jz6-0005oY-5j for qemu-devel@nongnu.org; Thu, 16 Jan 2014 05:15:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3jz5-0005o2-RB for qemu-devel@nongnu.org; Thu, 16 Jan 2014 05:15:36 -0500 Date: Thu, 16 Jan 2014 10:15:22 +0000 From: "Daniel P. Berrange" Message-ID: <20140116101522.GB29231@redhat.com> References: <1389172376-30636-1-git-send-email-lilei@linux.vnet.ibm.com> <1389172376-30636-5-git-send-email-lilei@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1389172376-30636-5-git-send-email-lilei@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH 4/6] virtfs-proxy-helper: replace send_fd with qemu_send_with_fd Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: pbonzini@redhat.com, mohan@in.ibm.com, qemu-devel@nongnu.org On Wed, Jan 08, 2014 at 05:12:54PM +0800, Lei Li wrote: > Signed-off-by: Lei Li > --- > fsdev/virtfs-proxy-helper.c | 51 ++++++------------------------------------ > hw/9pfs/virtio-9p-proxy.h | 5 ---- > 2 files changed, 8 insertions(+), 48 deletions(-) > > diff --git a/fsdev/virtfs-proxy-helper.c b/fsdev/virtfs-proxy-helper.c > index 713a7b2..44c6e61 100644 > --- a/fsdev/virtfs-proxy-helper.c > +++ b/fsdev/virtfs-proxy-helper.c > -static int send_fd(int sockfd, int fd) > -{ ... > - /* No ancillary data on error */ > - if (fd < 0) { > - /* fd is really negative errno if the request failed */ > - data = fd; > - } else { > - data = V9FS_FD_VALID; The way data is initialized here... > @@ -784,11 +743,17 @@ static void usage(char *prog) > static int process_reply(int sock, int type, > struct iovec *out_iovec, int retval) > { > + int data = V9FS_FD_VALID; Doesn't match what you do here. > + > switch (type) { > case T_OPEN: > case T_CREATE: > - if (send_fd(sock, retval) < 0) { > + if (qemu_send_with_fd(sock, retval, &data, sizeof(data)) < 0) { > return -1; > + } else { > + if (retval >= 0) { > + close(retval); > + } > } > break; > case T_MKNOD: Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|