summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKalle Olavi Niemitalo <kon@iki.fi>2016-08-26 17:23:28 +0300
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-01-08 22:53:03 +0100
commit5dbe5dfd27633ebf2cc0e37fa7036fb1a689ef81 (patch)
treec12a4256607368b9ff64700327202d333b059be4
parentf7c3556e627bd6ede22255defb55084d21e4dca6 (diff)
rpctrace: Pass prefixed_name to _hurd_exec_paths.
This fixes the following test case: mkdir testy echo '#! /bin/bash' > testy/prog echo 'printf "%s\n" "$0"' >> testy/prog chmod +x testy/prog PATH=$(pwd)/testy /bin/rpctrace -E PATH=/usr/bin:/bin -o /dev/null prog Before this patch, the output is: /bin/bash: prog: No such file or directory After this patch, the output is similar to: /home/kalle/testy/prog * utils/rpctrace.c (traced_spawn): Get prefixed_name from file_name_path_lookup and pass it to _hurd_exec_paths.
-rw-r--r--utils/rpctrace.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 1690ae1b..b4de175c 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -1620,8 +1620,9 @@ traced_spawn (char **argv, char **envp)
task_t traced_task;
struct sender_info *ti;
struct receiver_info *receive_ti;
+ char *prefixed_name;
file_t file = file_name_path_lookup (argv[0], getenv ("PATH"),
- O_EXEC, 0, 0);
+ O_EXEC, 0, &prefixed_name);
if (file == MACH_PORT_NULL)
error (1, errno, "command not found: %s", argv[0]);
@@ -1662,7 +1663,8 @@ traced_spawn (char **argv, char **envp)
the actual task, so the RPCs to map in the program itself do not get
traced. Could have an option to use TASK_WRAPPER here instead. */
#ifdef HAVE__HURD_EXEC_PATHS
- err = _hurd_exec_paths (traced_task, file, *argv, *argv, argv, envp);
+ err = _hurd_exec_paths (traced_task, file, prefixed_name ?: *argv,
+ prefixed_name ?: *argv, argv, envp);
#else
err = _hurd_exec (traced_task, file, argv, envp);
#endif
@@ -1673,6 +1675,7 @@ traced_spawn (char **argv, char **envp)
cannot die and hence our TRACED_TASK ref cannot have been released. */
mach_port_deallocate (mach_task_self (), task_wrapper);
+ free (prefixed_name);
return pid;
}