From patchwork Tue Sep 10 16:35:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 1160481 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 46SW4912t0z9s4Y for ; Wed, 11 Sep 2019 02:40:41 +1000 (AEST) Received: from localhost ([::1]:42952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7jC2-0008U0-Ja for incoming@patchwork.ozlabs.org; Tue, 10 Sep 2019 12:40:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53239) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7j7x-0004fS-F1 for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7j7w-00029R-By for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:25 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:50289) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7j7w-00028h-2q for qemu-devel@nongnu.org; Tue, 10 Sep 2019 12:36:24 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mbzhv-1ih4sB2VsF-00dZ1m; Tue, 10 Sep 2019 18:36:08 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2019 18:35:46 +0200 Message-Id: <20190910163600.19971-2-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190910163600.19971-1-laurent@vivier.eu> References: <20190910163600.19971-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:3R9/nrf6F1+CkOxpfuZXTiwuoLi5+ZCthPICIeKxQmd0X1UvGFI MQmzmbiT/3J+WnCW6EqF81pvOlc3TzWWY37E+FojlVlnQfUN+O7bVrOQkpJsNDh5wANfigX CaHHcknek7lf/z2cNEXB1/bPjYqZSM5pd+K0vwCw4/aW7OKUXjY22SQnNP3yzNIqb0R8UoF RJnInhWrsHAPV3z/SLnxg== X-UI-Out-Filterresults: notjunk:1; V03:K0:UvcckU/Hz6g=:6lal6D9cpfbS/ftM1T8tvo dN3z4J0yjaeCS3Uj76R5rRNSPOFtomsNK0n5Q489+P7P0OrPMSp+qavKVbKaiu7v5CmxY/gW8 kp2juFqUy6Fpiqs1/x0fbhGxFNUy85owI8QMQITeR76BF+AYcFVGivIbUB6O0QonWH/WkFkKZ 75VGcTldsBkmb7QpcNexPgasZMS4p8m3FTdR7cSIei6F7veyLiXfq1uQ56Q2TYaV+3laeBpEH Kr+MvQQOokx2SR6gX3iBbCUFSTQYbzT65Ni21odrW0TRlpHppCHJnR/Pm2pGrEDVmJv5SQ1tz dAIDTvtxBET7PtGCwyjsW6PmxVrlACmDqNL5I2uhSMyjRCcloGgnnKBnwSTLfRW4sid3e4if6 CUxqeWiZ0W+2ZmeaCaHBpiqt04092H65c95422SbeZRmD8ubE1K8lZ7GXwlg2E0lS9Gv1nmd1 ekU0V2GubZan6F3ggM/OG5eH//ZvQU7vKjCh8Hjh0z21+gECJgG5be9ClM22tXpjk4STkWRg+ hQV9XxZq+TlWfxOpt16gqxDmYy3SzPey9gTqX9B0jLqhzyBKunqvKmqLrz6Jz3W2w8V5WMxYp XcOUo90PtOGoBKqs3GuVD7Ntiw2QV/c/i3m+5WY+W0p3tqyJWPAYOIlQfC2rUvhN37dDF80Vq OtWkqF3htZYjC7KI2PAELMiaf6/OgAK47MAdh5MpGZpPbVKGG0QQIPMb4LbQ3snLN018txDpQ 8MxHgeQeEN+gP5nRa8X2sRvcaCtcKKXEXOC02eTgl48fnAszyPdhJ/XEn5ZnHEjbbSgD2/EUT A5EQbUnNVKIQWx5dBFksaqPGQVzXww0LrBu433CH65dICWrAc8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [PULL 01/15] 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: Max Filippov , Riku Voipio , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Stefano Garzarella 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: Philippe Mathieu-Daudé Reviewed-by: Stefano Garzarella Message-Id: <20190714134028.315-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier --- 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); }