[hurd,commited] hurd: Fix spawni adding . to PATH [BZ #34932]

Samuel Thibault samuel.thibault@ens-lyon.org
Mon Nov 2 23:40:27 GMT 2026


This follows the 1eb893060870 ("posix: execvpe cleanup") common execvpe
cleanup which was not propagated to the Hurd-specific spawni.
---
 sysdeps/mach/hurd/spawni.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index 375f763633..d9268f71cb 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <paths.h>
+#include <confstr.h>
 #include <spawn.h>
 #include <stdlib.h>
 #include <string.h>
@@ -44,7 +45,8 @@ __spawni (pid_t *pid, const char *file,
 	  int xflags)
 {
   pid_t new_pid;
-  char *path, *p, *name;
+  const char *path, *p;
+  char *name;
   char *concat_name = NULL;
   const char *relpath, *abspath;
   int res;
@@ -732,15 +734,7 @@ retry:
       /* We have to search for FILE on the path.  */
       path = getenv ("PATH");
       if (path == NULL)
-	{
-	  /* There is no `PATH' in the environment.
-	     The default search path is the current directory
-	     followed by the path `confstr' returns for `_CS_PATH'.  */
-	  len = __confstr (_CS_PATH, (char *) NULL, 0);
-	  path = (char *) __alloca (1 + len);
-	  path[0] = ':';
-	  (void) __confstr (_CS_PATH, path + 1, len);
-	}
+	path = CS_PATH;
 
       len = strlen (file) + 1;
       pathlen = strlen (path);
-- 
2.53.0



More information about the Libc-alpha mailing list