From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:49621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGvKg-0004yg-QL for qemu-devel@nongnu.org; Thu, 20 Oct 2011 12:19:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RGvKe-0003N3-OB for qemu-devel@nongnu.org; Thu, 20 Oct 2011 12:19:02 -0400 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:57074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RGvKd-0003L8-QM for qemu-devel@nongnu.org; Thu, 20 Oct 2011 12:19:00 -0400 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [202.81.31.246]) by e23smtp06.au.ibm.com (8.14.4/8.13.1) with ESMTP id p9KGHTAb004055 for ; Fri, 21 Oct 2011 03:17:29 +1100 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9KGGACj1282080 for ; Fri, 21 Oct 2011 03:16:11 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9KGIhIV022538 for ; Fri, 21 Oct 2011 03:18:43 +1100 From: "Aneesh Kumar K.V" Date: Thu, 20 Oct 2011 21:47:33 +0530 Message-Id: <1319127460-5181-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1319127460-5181-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1319127460-5181-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 1/8] hw/9pfs: Fix error handling in local_mknod List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, "Aneesh Kumar K.V" From: "Aneesh Kumar K.V" Update local_chown to remove unnecessary if loop Signed-off-by: Aneesh Kumar K.V --- hw/9pfs/virtio-9p-local.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/9pfs/virtio-9p-local.c b/hw/9pfs/virtio-9p-local.c index d561de8..b611681 100644 --- a/hw/9pfs/virtio-9p-local.c +++ b/hw/9pfs/virtio-9p-local.c @@ -281,7 +281,7 @@ static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, if (err == -1) { goto out; } - local_set_xattr(rpath(fs_ctx, path, buffer), credp); + err = local_set_xattr(rpath(fs_ctx, path, buffer), credp); if (err == -1) { serrno = errno; goto err_end; @@ -551,15 +551,12 @@ static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp) char *path = fs_path->data; if ((credp->fc_uid == -1 && credp->fc_gid == -1) || - (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH)) { - return lchown(rpath(fs_ctx, path, buffer), credp->fc_uid, - credp->fc_gid); + (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || + (fs_ctx->export_flags & V9FS_SM_NONE)) { + return lchown(rpath(fs_ctx, path, buffer), + credp->fc_uid, credp->fc_gid); } else if (fs_ctx->export_flags & V9FS_SM_MAPPED) { return local_set_xattr(rpath(fs_ctx, path, buffer), credp); - } else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) || - (fs_ctx->export_flags & V9FS_SM_NONE)) { - return lchown(rpath(fs_ctx, path, buffer), credp->fc_uid, - credp->fc_gid); } return -1; } -- 1.7.5.4