From patchwork Sun Sep 8 10:48:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1159431 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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=vivier.eu 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 46R7QN0t0yz9s7T for ; Sun, 8 Sep 2019 20:51:40 +1000 (AEST) Received: from localhost ([::1]:47854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6unC-0003gv-2Z for incoming@patchwork.ozlabs.org; Sun, 08 Sep 2019 06:51:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54488) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i6ukH-0003bD-VZ for qemu-devel@nongnu.org; Sun, 08 Sep 2019 06:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i6ukG-0004dD-V0 for qemu-devel@nongnu.org; Sun, 08 Sep 2019 06:48:37 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:59915) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i6ukG-0004aW-LL for qemu-devel@nongnu.org; Sun, 08 Sep 2019 06:48:36 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MRnTQ-1hjDyx0i30-00TFdD; Sun, 08 Sep 2019 12:48:21 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Sun, 8 Sep 2019 12:48:15 +0200 Message-Id: <20190908104816.20713-1-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:KoCgvAiafcQ9otrq6itW9xO115jMTh2G5idkN0FZKSZgNixM/j/ t97GUVtETzL3SqqB4RAfg0VzT2TocwkUjuWDQ3/0atAJNZs6/bv4qGeWjVogqZVWlSPuknB KRHVbdOEVIwa6FtzO/w4Rdtzy3vUjMqrxaVkgGEjMWjF684ALbGO35CXoGBtUtE7GKohbvn sQt8vuaH6jRhuzZiYz64g== X-UI-Out-Filterresults: notjunk:1; V03:K0:RykH3zLm6Yc=:qUogJkeoFF2k63T2V6fX9e OcSWk2BaSAPiHVjXqn4djzY9bz/z4kUwbLWth35gBh4Xgi3yEQoTekaKVgoKTIrV9P7fzQQZK gigaTQ8VxQJkaCJmRX7T6Nd3hr3T6KUznvj8gO9AybLSGsY4sNt5Av+49At6brQ9mkr2UrN6b AKOHvWt6LVWSD1naiIkoaaDvZq5azmXWUQw4Dus8puFf2qpAOVnPmdblfTP61eUOIKLU1zb4k 6a6s52oVYFujeVLgxFEQEDVynjzCZLPRd2MN5onI/lSQaeNSc9WyxN0wiy4hrCCg6ROwThPZq uWNtxZaCNSogKURA7wM3QvzZ25wQ1UZGVnQRAxsJVBQL5eiduozrjN4Pyz3b/Zb9mDjTbl0sJ 4xHXooIq0c3roFVCaE83LiySwkB00XnY0XjeRL6t8iTFP+PJbvbdoowwPJM2Mn/VcXbA3Xc5W 3qr6ha4Ayz8yQVI1SeSqua4dRrjIurI9YIykFwxQMsCXbsG7DAvFuPfqYhKZi+DxhV0LZ/h3q RRc+Krq5jp2CLMcDCfAT2l1RRmBsYG920RWL/0LcvMRUiOICeB8I6pmrOFY8spP8ieZBNdBjZ hCC3nXONDKCBLgQZ75J6/bGFbYZSu0Lt5i2auh83I1isg/vMq5MgIGop9i0yAix/PbPIfQsQ3 W1JTvjZIbRXDQo6UcjnmhYMO6OPeAvP72epakaOD10wLubsi/vfQ7DP3oGZ8gnKcLYofHVW0o GUi9EEJqse0MYJpSWu930URP1NBtIizENiQB+PArvlrHnRPntP/7i6LHYi1WYOt1cWlCAqSBE v6ceuBE4TpZXXbRr9/HQn8NUOTSVdHJL54QO14ijEQoeMA4wbU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.74 Subject: [Qemu-devel] [PATCH v2 1/2] linux-user: remove useless variable 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: , Cc: Peter Maydell , Riku Voipio , Laurent Vivier , John Paul Adrian Glaubitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" filename is only used to open the file if AT_EXECFD is not provided. But exec_path already contains the path of the file to open. Remove filename as it is only used in main.c whereas exec_path is also used in syscall.c. Fixes: d088d664f201 ("linux-user: identify running binary in /proc/self/exe") Signed-off-by: Laurent Vivier Reviewed-by: Stefano Garzarella --- linux-user/main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 47917bbb20fc..28f0065b6ddf 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -49,7 +49,6 @@ char *exec_path; int singlestep; -static const char *filename; static const char *argv0; static int gdbstub_port; static envlist_t *envlist; @@ -586,7 +585,6 @@ static int parse_args(int argc, char **argv) exit(EXIT_FAILURE); } - filename = argv[optind]; exec_path = argv[optind]; return optind; @@ -657,9 +655,9 @@ int main(int argc, char **argv, char **envp) execfd = qemu_getauxval(AT_EXECFD); if (execfd == 0) { - execfd = open(filename, O_RDONLY); + execfd = open(exec_path, O_RDONLY); if (execfd < 0) { - printf("Error while loading %s: %s\n", filename, strerror(errno)); + printf("Error while loading %s: %s\n", exec_path, strerror(errno)); _exit(EXIT_FAILURE); } } @@ -784,10 +782,10 @@ int main(int argc, char **argv, char **envp) cpu->opaque = ts; task_settid(ts); - ret = loader_exec(execfd, filename, target_argv, target_environ, regs, + ret = loader_exec(execfd, exec_path, target_argv, target_environ, regs, info, &bprm); if (ret != 0) { - printf("Error while loading %s: %s\n", filename, strerror(-ret)); + printf("Error while loading %s: %s\n", exec_path, strerror(-ret)); _exit(EXIT_FAILURE); }