[klibc] [klibc:master] [EVAL] Avoid using undefined handler

klibc-bot for Jim Meyering meyering at redhat.com
Mon Jul 2 02:12:05 PDT 2012


Commit-ID:  973826c37ec8492514a8dae5b507d0873ee5afb2
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=973826c37ec8492514a8dae5b507d0873ee5afb2
Author:     Jim Meyering <meyering at redhat.com>
AuthorDate: Fri, 8 Jul 2011 16:41:24 +0800
Committer:  maximilian attems <max at stro.at>
CommitDate: Mon, 2 Jul 2012 10:44:58 +0200

[klibc] [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: maximilian attems <max at stro.at>

---
 usr/dash/eval.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index d675ba7..8dc84ce 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -901,9 +901,9 @@ evalbltin(const struct builtincmd *cmd, int argc, char **argv, int flags)
 	int i;
 
 	savecmdname = commandname;
+	savehandler = handler;
 	if ((i = setjmp(jmploc.loc)))
 		goto cmddone;
-	savehandler = handler;
 	handler = &jmploc;
 	commandname = argv[0];
 	argptr = argv + 1;
@@ -934,11 +934,11 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
 
 	saveparam = shellparam;
 	savefuncline = funcline;
+	savehandler = handler;
 	if ((e = setjmp(jmploc.loc))) {
 		goto funcdone;
 	}
 	INTOFF;
-	savehandler = handler;
 	handler = &jmploc;
 	shellparam.malloc = 0;
 	func->count++;


More information about the klibc mailing list