summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2012-02-21 21:52:09 +0100
committerAxel Beckert <abe@deuxchevaux.org>2012-02-21 21:52:55 +0100
commitb561eedd8b1d70a2b3339d167348771f1a8fc5c7 (patch)
treea7d7d32a90f391767a921a5fcdb59551cdffa04e /Src/exec.c
parent340a3b41e51e3f39249a9e28f0615b063f073a3c (diff)
parent5f25bb8223d090d13af5869893fa35e5b8c44182 (diff)
downloadzsh-b561eedd8b1d70a2b3339d167348771f1a8fc5c7.tar.gz
zsh-b561eedd8b1d70a2b3339d167348771f1a8fc5c7.zip
New upstream release
Merge branch 'upstream' into debian
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 9b3c50372..503e0843d 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2174,8 +2174,8 @@ addvars(Estate state, Wordcode pc, int addflags)
vl = ecgetlist(state, WC_ASSIGN_NUM(ac), EC_DUPTOK, &htok);
if (vl && htok) {
- prefork(vl, (isstr ? (PF_SINGLE|PF_ASSIGN) :
- PF_ASSIGN));
+ prefork(vl, (isstr ? (PREFORK_SINGLE|PREFORK_ASSIGN) :
+ PREFORK_ASSIGN));
if (errflag) {
state->pc = opc;
return;
@@ -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;
@@ -2541,7 +2552,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
}
/* Do prefork substitutions */
- esprefork = (assign || isset(MAGICEQUALSUBST)) ? PF_TYPESET : 0;
+ esprefork = (assign || isset(MAGICEQUALSUBST)) ? PREFORK_TYPESET : 0;
if (args && htok)
prefork(args, esprefork);