commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 13/16: rpctrace: Pass prefixed_name to _hurd_exec_paths.


From: Samuel Thibault
Subject: [hurd] 13/16: rpctrace: Pass prefixed_name to _hurd_exec_paths.
Date: Tue, 09 Jan 2018 01:35:30 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit 5dbe5dfd27633ebf2cc0e37fa7036fb1a689ef81
Author: Kalle Olavi Niemitalo <address@hidden>
Date:   Fri Aug 26 17:23:28 2016 +0300

    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.
---
 utils/rpctrace.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index 1690ae1..b4de175 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;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]