From patchwork Sun Sep 25 04:25:35 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 116442 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 60D00B6F64 for ; Tue, 27 Sep 2011 01:51:46 +1000 (EST) Received: from localhost ([::1]:56178 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8DT4-0000UG-QD for incoming@patchwork.ozlabs.org; Mon, 26 Sep 2011 11:51:42 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8DSt-0000Kz-5X for qemu-devel@nongnu.org; Mon, 26 Sep 2011 11:51:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R8DSm-0000ps-Gb for qemu-devel@nongnu.org; Mon, 26 Sep 2011 11:51:31 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51853 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R8DSm-0000nX-4O for qemu-devel@nongnu.org; Mon, 26 Sep 2011 11:51:24 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id D6BF6916B4; Mon, 26 Sep 2011 17:51:21 +0200 (CEST) From: Alexander Graf To: qemu-devel@nongnu.org Date: Sun, 25 Sep 2011 06:25:35 +0200 Message-Id: <1316924735-20612-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: riku.voipio@linaro.org Subject: [Qemu-devel] [PATCH] 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 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 --- 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 6b73769..27970a4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -376,25 +376,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));