ash: [EVAL] Avoid using undefined handler

Upstream commit:

    Date: Fri, 8 Jul 2011 16:41:24 +0800
    [EVAL] Avoid using undefined handler

    * src/eval.c (evalbltin, evalfun): Set savehandler before calling
    setjmp with the possible "goto *done", where savehandler is used.
    Otherwise, clang warns that "Assigned value is garbage or undefined"
    at the point where "savehandler" is used on the RHS.

    Signed-off-by: Jim Meyering <meyering@redhat.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2016-09-30 11:30:11 +02:00
parent 53d6e03a0a
commit a2d121cc1b

View File

@ -8944,12 +8944,12 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
saveparam = shellparam; saveparam = shellparam;
savelocalvars = localvars; savelocalvars = localvars;
savehandler = exception_handler;
e = setjmp(jmploc.loc); e = setjmp(jmploc.loc);
if (e) { if (e) {
goto funcdone; goto funcdone;
} }
INT_OFF; INT_OFF;
savehandler = exception_handler;
exception_handler = &jmploc; exception_handler = &jmploc;
localvars = NULL; localvars = NULL;
shellparam.malloced = 0; shellparam.malloced = 0;
@ -9595,10 +9595,10 @@ evalbltin(const struct builtincmd *cmd, int argc, char **argv)
int i; int i;
savecmdname = commandname; savecmdname = commandname;
savehandler = exception_handler;
i = setjmp(jmploc.loc); i = setjmp(jmploc.loc);
if (i) if (i)
goto cmddone; goto cmddone;
savehandler = exception_handler;
exception_handler = &jmploc; exception_handler = &jmploc;
commandname = argv[0]; commandname = argv[0];
argptr = argv + 1; argptr = argv + 1;