* libmisc/shell.c, src/su.c: Execute the scripts with "sh -"
rather than "sh".
This commit is contained in:
parent
db38a728d1
commit
24cfe44b07
@ -1,3 +1,8 @@
|
|||||||
|
2009-07-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* libmisc/shell.c, src/su.c: Execute the scripts with "sh -"
|
||||||
|
rather than "sh".
|
||||||
|
|
||||||
2009-07-22 Nicolas François <nicolas.francois@centraliens.net>
|
2009-07-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* configure.in, libmisc/shell.c, libmisc/setupenv.c, src/newgrp.c,
|
* configure.in, libmisc/shell.c, libmisc/setupenv.c, src/newgrp.c,
|
||||||
|
@ -85,7 +85,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[])
|
|||||||
* Assume this is a shell script (with no shebang).
|
* Assume this is a shell script (with no shebang).
|
||||||
* Interpret it with /bin/sh
|
* Interpret it with /bin/sh
|
||||||
*/
|
*/
|
||||||
execle (SHELL, "sh", file, (char *)0, envp);
|
execle (SHELL, "sh", "-", file, (char *)0, envp);
|
||||||
err = errno;
|
err = errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
src/su.c
9
src/su.c
@ -194,12 +194,13 @@ void execve_shell (const char *shellstr, char *args[], char *const envp[])
|
|||||||
while (NULL != args[n_args]) {
|
while (NULL != args[n_args]) {
|
||||||
n_args++;
|
n_args++;
|
||||||
}
|
}
|
||||||
targs = (char **) xmalloc ((n_args + 2) * sizeof (args[0]));
|
targs = (char **) xmalloc ((n_args + 3) * sizeof (args[0]));
|
||||||
targs[0] = "sh";
|
targs[0] = "sh";
|
||||||
targs[1] = xstrdup (shellstr);
|
targs[1] = "-";
|
||||||
targs[n_args+1] = NULL;
|
targs[2] = xstrdup (shellstr);
|
||||||
|
targs[n_args+2] = NULL;
|
||||||
while (1 != n_args) {
|
while (1 != n_args) {
|
||||||
targs[n_args] = args[n_args - 1];
|
targs[n_args+1] = args[n_args - 1];
|
||||||
n_args--;
|
n_args--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user