aboutsummaryrefslogtreecommitdiff
path: root/linux-user/main.c
diff options
context:
space:
mode:
authorLaurent Vivier <laurent@vivier.eu>2019-07-14 15:40:27 +0200
committerLaurent Vivier <laurent@vivier.eu>2019-09-10 10:28:50 +0200
commit9d3019bce39efd32f54d31d4aedef27a31a15c24 (patch)
treeeb9b8be053427e6ee1451a08a520c93b758a188a /linux-user/main.c
parent89ea03a7dc83ca36b670ba7f787802791fcb04b1 (diff)
linux-user: remove useless variable
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 <laurent@vivier.eu> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Message-Id: <20190714134028.315-1-laurent@vivier.eu> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/main.c')
-rw-r--r--linux-user/main.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 47917bbb20..28f0065b6d 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);
}