From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=34182 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PqJMo-0001bC-EO for qemu-devel@nongnu.org; Fri, 18 Feb 2011 00:58:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PqJMn-00007M-92 for qemu-devel@nongnu.org; Fri, 18 Feb 2011 00:58:58 -0500 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:56054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PqJMm-000066-LE for qemu-devel@nongnu.org; Fri, 18 Feb 2011 00:58:57 -0500 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp05.au.ibm.com (8.14.4/8.13.1) with ESMTP id p1I5rCaa000691 for ; Fri, 18 Feb 2011 16:53:12 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1I5wfbn1519832 for ; Fri, 18 Feb 2011 16:58:41 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1I5wemP001851 for ; Fri, 18 Feb 2011 16:58:40 +1100 From: "M. Mohan Kumar" Subject: Re: [Qemu-devel] Re: [V5 PATCH 6/8] virtio-9p: Support for creating special files Date: Fri, 18 Feb 2011 11:28:37 +0530 References: <1297858995-24676-1-git-send-email-mohan@in.ibm.com> <1297858995-24676-7-git-send-email-mohan@in.ibm.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102181128.37793.mohan@in.ibm.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: blauwirbel@gmail.com, Stefan Hajnoczi On Thursday 17 February 2011 4:19:17 pm Stefan Hajnoczi wrote: > On Wed, Feb 16, 2011 at 12:23 PM, M. Mohan Kumar wrote: > > + switch (type) { > > + case T_MKNOD: > > + request.data.type = T_MKNOD; > > + break; > > + case T_MKDIR: > > + request.data.type = T_MKDIR; > > + break; > > + case T_SYMLINK: > > + request.data.type = T_SYMLINK; > > + break; > > + case T_LINK: > > + request.data.type = T_LINK; > > + break; > > + } > > Or just request.data.type = type? > Oops, I will modify. > > + if (oldpath) { > > + request.data.oldpath_len = strlen(oldpath); > > + strcpy(request.path.old_path, oldpath); > > It's not obvious that this strcpy() is safe. > I will change the code. > > + } > > + retval = v9fs_create_special(fs_ctx, &request, &error); > > + if (retval < 0) { > > + errno = error; > > + return 0; > > This looks suspicious. Should the return value be negative on error? Yes, it should return negative on error, I will update. > > > + char *tmp = qemu_strdup(rpath(fs_ctx, oldpath)); > > + if (tmp == NULL) { > > QEMU strdup never returns NULL. Ok. > > Stefan ---- M. Mohan Kumar