From patchwork Thu Oct 27 12:02:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 122140 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5E35FB6F8B for ; Thu, 27 Oct 2011 23:24:17 +1100 (EST) Received: from localhost ([::1]:58131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJOgM-00046s-NJ for incoming@patchwork.ozlabs.org; Thu, 27 Oct 2011 08:03:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:38007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJOfo-0002Xg-20 for qemu-devel@nongnu.org; Thu, 27 Oct 2011 08:03:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJOfi-0003KA-Gf for qemu-devel@nongnu.org; Thu, 27 Oct 2011 08:03:04 -0400 Received: from afflict.kos.to ([92.243.29.197]:35223) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJOfi-0003Jb-BL for qemu-devel@nongnu.org; Thu, 27 Oct 2011 08:02:58 -0400 Received: by afflict.kos.to (Postfix, from userid 1000) id 54FEC2666B; Thu, 27 Oct 2011 12:02:56 +0000 (UTC) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Thu, 27 Oct 2011 15:02:50 +0300 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 92.243.29.197 Cc: Alexander Graf Subject: [Qemu-devel] [PATCH 04/10] linux-user: fix openat X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Alexander Graf When running openat using qemu-arm, we stumbled over invalid permissions on the created files. The reason for this is that the mode parameter gets treates as an O_... flag, which it isn't - it's a permission bitmask. This patch removes the needless translation of the mode parameter, rendering permission passing of openat() to work with linux-user. Reported-by: Dirk Mueller Signed-off-by: Alexander Graf Signed-off-by: Riku Voipio --- linux-user/syscall.c | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 9a63357..6159571 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -379,25 +379,13 @@ static int sys_mknodat(int dirfd, const char *pathname, mode_t mode, } #endif #ifdef TARGET_NR_openat -static int sys_openat(int dirfd, const char *pathname, int flags, ...) +static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode) { /* * open(2) has extra parameter 'mode' when called with * flag O_CREAT. */ if ((flags & O_CREAT) != 0) { - va_list ap; - mode_t mode; - - /* - * Get the 'mode' parameter and translate it to - * host bits. - */ - va_start(ap, flags); - mode = va_arg(ap, mode_t); - mode = target_to_host_bitmask(mode, fcntl_flags_tbl); - va_end(ap); - return (openat(dirfd, pathname, flags, mode)); } return (openat(dirfd, pathname, flags));