From: anton Date: Mon, 18 Dec 2017 20:30:14 +0000 (+0000) Subject: Get rid of a todo by stop declaring variable texec as static and instead zeroing X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b11c7a774cec1b395372c92d0ca7c88a29c7696d;p=openbsd 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@ --- 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;