[git commit] ash: [EVAL] Avoid using undefined handler

Denys Vlasenko vda.linux at googlemail.com
Fri Sep 30 09:30:11 UTC 2016


commit: https://git.busybox.net/busybox/commit/?id=a2d121cc1bb8ef391f9171bb3799e1572904d74c
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

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 at redhat.com>
    Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/ash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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


More information about the busybox-cvs mailing list