]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix spawni SPAWN_XFLAGS_TRY_SHELL with empty argv
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 26 Dec 2020 15:39:40 +0000 (16:39 +0100)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sat, 26 Dec 2020 15:39:40 +0000 (16:39 +0100)
When argv is empty, we need to add the original script to be run on the
shell command line.

sysdeps/mach/hurd/spawni.c

index 2aeed683fefc259b0a550617f6acb795e7dfe558..b511265044e2a80b7c8ce020f1419af9e7a3aba2 100644 (file)
@@ -842,7 +842,11 @@ __spawni (pid_t *pid, const char *file,
       {
        /* The file is accessible but it is not an executable file.
           Invoke the shell to interpret it as a script.  */
-       err = __argz_insert (&args, &argslen, args, _PATH_BSHELL);
+       err = 0;
+       if (!argslen)
+         err = __argz_insert (&args, &argslen, args, relpath);
+       if (!err)
+         err = __argz_insert (&args, &argslen, args, _PATH_BSHELL);
        if (!err)
          err = child_lookup (_PATH_BSHELL, O_EXEC, 0, &execfile);
        if (!err)