aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-26 16:39:40 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-26 16:39:40 +0100
commita39b95b975929f12359d4bc55f25bd88c3ec02c5 (patch)
treeda4908533fb9852d2d9e7beeb6aae7ad2146f87e
parent13adfa34aff03fd9f1c1612b537a0d736ddb6c2b (diff)
downloadglibc-a39b95b975929f12359d4bc55f25bd88c3ec02c5.zip
glibc-a39b95b975929f12359d4bc55f25bd88c3ec02c5.tar.gz
glibc-a39b95b975929f12359d4bc55f25bd88c3ec02c5.tar.bz2
hurd: Fix spawni SPAWN_XFLAGS_TRY_SHELL with empty argv
When argv is empty, we need to add the original script to be run on the shell command line.
-rw-r--r--sysdeps/mach/hurd/spawni.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c
index 2aeed68..b511265 100644
--- a/sysdeps/mach/hurd/spawni.c
+++ b/sysdeps/mach/hurd/spawni.c
@@ -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)