From patchwork Wed Sep 11 06:49:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 11140447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4F05F112B for ; Wed, 11 Sep 2019 07:04:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2D2FD222BF for ; Wed, 11 Sep 2019 07:04:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D2FD222BF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=vivier.eu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:47148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wgF-00059v-3J for patchwork-qemu-devel@patchwork.kernel.org; Wed, 11 Sep 2019 03:04:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40899) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7wRk-00068g-Ad for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i7wRj-0004Qj-8g for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:44 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:58021) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i7wRj-0004Py-0H for qemu-devel@nongnu.org; Wed, 11 Sep 2019 02:49:43 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mzhzd-1iLKWS2rw1-00vbu6; Wed, 11 Sep 2019 08:49:25 +0200 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Wed, 11 Sep 2019 08:49:06 +0200 Message-Id: <20190911064920.1718-2-laurent@vivier.eu> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190911064920.1718-1-laurent@vivier.eu> References: <20190911064920.1718-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:XRNaDVW/Z6FFauGWDmfsEwdbmHLOp9czIYg/b7ZfJNy9qHKSfGE H29vtQwz34phoQeBvDFaul7IhkYM7kkgeblbhRyuVReX6iH2xZ0HQbw6cNuQAmyNWe/5v9h OM+/n4WMocQe/9ZzRR1wVkMA2ZYxKhwMYPs//Eu+fxr8fnwqbEpH1nunhTqRVJ+HjaqObim Kiy5vJZZvdnyG+1Fc2NRg== X-UI-Out-Filterresults: notjunk:1;V03:K0:g+4deSDCMqQ=:5LDGnoSHT9zYaHZq4eChyl wkBSEG1Lm965AykirnABv66GwVBtdb3be0NMI80huF3vxDRXl+YgcYjL2zYeuyGmP2buUFjyg E++sGDaBdgxa0HUW0Bp7Ju+iXXJM3sXM3SYJ+1JthrI32ZJ16q9q4vZvvQbtdpRDF8J8iy10V /txQccNthfJWCX0ZkJQAfXCw31es6yCNuVM1BQ3NEQ2KfY3RG9kyWQUG+QD0DwRF8wL6kZqEx vIqr1ZLkcYh8Wx41QoyA7l+wLjOVjxrARUUfEUXjYdO+PA3swHavAeIWOzi7uG+nqP7bqFvgX o1dQqTysDZzEJ45/CgBaYBhORKNYPQFaRfcwXDsqHRK+U8JSkVpMYWVJhoqMmKATPyHiSs6ov IV4+oxiQyJfht6sznBDER3qbhGsZI+g/d8gZekuJNgBB1p5C2aKtQjmjlYlKbwPjH6cmiFfI/ Q1W2gs9nDRybBGek2RTrID+241hYXC3JFFSZOhAbuBybDxfDVek2ZV+iYSv+BjDBeRDETXDzh dqIcJr0x56rz3lgsCg3cCDDIxUiNBcWJu7ZKxIpch00cio61JPjlqk9MnUQ9MdC6GHt4dhGbx 2PWk8c+UNCeX2/2qoamLvKIWWO0lpzTC2I03bujsu6i6C+5x46XJxqFty2tbxFL0X4gQ4NCSF UTkngEnueaR/ipcBBjqpvYcmXlFUgqe0b0eM+EpRF1A0KZhE1Kp9EMsUBHaQXFwRUTrpCq4G/ VxkuZJmn0FoH1gAn7pLBwMPleEr1gFZzeIk0w+zT2KM9PAGydc7KxzbzA+sKIzXbwxLYsx7ls mg9TTswo+e/RjTV3sN2GxCOO9m/JR09NOng4Zpe5Nw7JSW4DHY= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.187 Subject: [Qemu-devel] [PULL v2 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+patchwork-qemu-devel=patchwork.kernel.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); }