diff options
author | anton <anton@cvs.openbsd.org> | 2017-12-18 20:30:15 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2017-12-18 20:30:15 +0000 |
commit | ca799b74684aa5dd8e172bbf3659c875a2acf022 (patch) | |
tree | 022e20148e680c2b21b20d78731f4af1f56b8687 /bin | |
parent | 0c4101c3f997a370a315bf597c175e75f0fae866 (diff) |
Get rid of a todo by stop declaring variable texec as static and instead zeroing
it out prior to continuing down the recursive call chain.
Initial diff from Michael W. Bombardieri, later tweaked; ok tb@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ksh/exec.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c index 7cabcaa289d..054f8f3e7cc 100644 --- a/bin/ksh/exec.c +++ b/bin/ksh/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.68 2016/12/11 17:49:19 millert Exp $ */ +/* $OpenBSD: exec.c,v 1.69 2017/12/18 20:30:14 anton Exp $ */ /* * execute command tree @@ -409,7 +409,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags, volatile int rv = 0; char *cp; char **lastp; - static struct op texec; /* Must be static (XXX but why?) */ + struct op texec; int type_flags; int keepasn_ok; int fcflags = FC_BI|FC_FUNC|FC_PATH; @@ -684,6 +684,7 @@ comexec(struct op *t, struct tbl *volatile tp, char **ap, volatile int flags, } /* to fork we set up a TEXEC node and call execute */ + memset(&texec, 0, sizeof(texec)); texec.type = TEXEC; texec.left = t; /* for tprint */ texec.str = tp->val.s; |