mirror of git://git.code.sf.net/p/zsh/code
30111: Src/exec.c: Fix segfaults with exec options.
This commit is contained in:
parent
737a87654f
commit
c8381cda78
|
@ -1,3 +1,7 @@
|
|||
2012-01-16 Frank Terbeck <ft@bewatermyfriend.org>
|
||||
|
||||
* 30111: Src/exec.c: Fix segfaults with exec options.
|
||||
|
||||
2012-01-09 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* Stepan Koltsov: 30105: Completion/Unix/Command/_stgit: fix
|
||||
|
@ -15856,5 +15860,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5561 $
|
||||
* $Revision: 1.5562 $
|
||||
*****************************************************
|
||||
|
|
13
Src/exec.c
13
Src/exec.c
|
@ -2487,6 +2487,11 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
|||
* with the zsh style.
|
||||
*/
|
||||
while (next && *next == '-' && strlen(next) >= 2) {
|
||||
if (!firstnode(args)) {
|
||||
zerr("exec requires a command to execute");
|
||||
errflag = lastval = 1;
|
||||
return;
|
||||
}
|
||||
uremnode(args, firstnode(args));
|
||||
if (!strcmp(next, "--"))
|
||||
break;
|
||||
|
@ -2499,6 +2504,11 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
|||
/* position on last non-NULL character */
|
||||
cmdopt += strlen(cmdopt+1);
|
||||
} else {
|
||||
if (!firstnode(args)) {
|
||||
zerr("exec requires a command to execute");
|
||||
errflag = lastval = 1;
|
||||
return;
|
||||
}
|
||||
if (!nextnode(firstnode(args))) {
|
||||
zerr("exec flag -a requires a parameter");
|
||||
errflag = lastval = 1;
|
||||
|
@ -2521,7 +2531,8 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
|||
return;
|
||||
}
|
||||
}
|
||||
next = (char *) getdata(nextnode(firstnode(args)));
|
||||
if (firstnode(args) && nextnode(firstnode(args)))
|
||||
next = (char *) getdata(nextnode(firstnode(args)));
|
||||
}
|
||||
if (exec_argv0) {
|
||||
char *str, *s;
|
||||
|
|
Loading…
Reference in New Issue