From patchwork Mon Apr 6 15:18:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 1266951 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48wyGn1W2sz9sQx for ; Tue, 7 Apr 2020 03:30:07 +1000 (AEST) Received: from localhost ([::1]:35602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLVZU-0001QX-Ij for incoming@patchwork.ozlabs.org; Mon, 06 Apr 2020 13:30:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60265) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jLVYw-0001P8-DU for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jLVYv-0008Dr-1x for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:29:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:58750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jLVYu-00084q-RS for qemu-devel@nongnu.org; Mon, 06 Apr 2020 13:29:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 660EFB1D7B for ; Mon, 6 Apr 2020 17:29:10 +0000 (UTC) From: Andreas Schwab To: qemu-devel@nongnu.org Subject: [PATCH] linux-user: Use getcwd syscall directly X-Yow: Are you still SEXUALLY ACTIVE? Did you BRING th' REINFORCEMENTS? Date: Mon, 06 Apr 2020 17:18:19 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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" The glibc getcwd function returns different errors than the getcwd syscall, which triggers an assertion failure in the glibc getcwd function when running under the emulation. Signed-off-by: Andreas Schwab --- linux-user/syscall.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 83c2891169..90c5433fec 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -375,14 +375,7 @@ static bitmask_transtbl fcntl_flags_tbl[] = { { 0, 0, 0, 0 } }; -static int sys_getcwd1(char *buf, size_t size) -{ - if (getcwd(buf, size) == NULL) { - /* getcwd() sets errno */ - return (-1); - } - return strlen(buf)+1; -} +_syscall2(int, sys_getcwd1, char *, buf, size_t, size) #ifdef TARGET_NR_utimensat #if defined(__NR_utimensat)