diff options
-rw-r--r-- | bin/sh/eval.c | 22 | ||||
-rw-r--r-- | bin/sh/histedit.c | 31 | ||||
-rw-r--r-- | bin/sh/parser.c | 20 | ||||
-rw-r--r-- | bin/sh/var.c | 6 |
4 files changed, 18 insertions, 61 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 5cee55e..eeea605 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -589,22 +589,14 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) struct cmdentry cmdentry; struct job *jp; struct jmploc jmploc; - struct jmploc *volatile savehandler; - char *volatile savecmdname; - volatile struct shparam saveparam; - struct localvar *volatile savelocalvars; + struct jmploc *savehandler; + char *savecmdname; + struct shparam saveparam; + struct localvar *savelocalvars; volatile int e; char *lastarg; int realstatus; int do_clearcmdentry; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &argv; - (void) &argc; - (void) &lastarg; - (void) &flags; - (void) &do_clearcmdentry; -#endif /* First expand the arguments. */ TRACE(("evalcommand(%p, %d) called\n", (void *)cmd, flags)); @@ -779,9 +771,10 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) savelocalvars = localvars; localvars = NULL; INTON; + savehandler = handler; if (setjmp(jmploc.loc)) { if (exception == EXSHELLPROC) - freeparam((struct shparam *)&saveparam); + freeparam(&saveparam); else { freeparam(&shellparam); shellparam = saveparam; @@ -791,7 +784,6 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) handler = savehandler; longjmp(handler->loc, 1); } - savehandler = handler; handler = &jmploc; for (sp = varlist.list ; sp ; sp = sp->next) mklocal(sp->text); @@ -830,12 +822,12 @@ evalcommand(union node *cmd, int flags, struct backcmd *backcmd) savecmdname = commandname; cmdenviron = varlist.list; e = -1; + savehandler = handler; if (setjmp(jmploc.loc)) { e = exception; exitstatus = (e == EXINT)? SIGINT+128 : 2; goto cmddone; } - savehandler = handler; handler = &jmploc; redirect(cmd->ncmd.redirect, mode); if (cmdentry.special) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 5698a8f..32b0448 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -173,25 +173,11 @@ histcmd(int argc, char **argv) char *pat = NULL, *repl; static int active = 0; struct jmploc jmploc; - struct jmploc *volatile savehandler; - char editfile[PATH_MAX]; + struct jmploc *savehandler; + char editfilestr[PATH_MAX]; + char *volatile editfile; FILE *efp; int oldhistnum; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &editor; - (void) &lflg; - (void) &nflg; - (void) &rflg; - (void) &sflg; - (void) &firststr; - (void) &laststr; - (void) &pat; - (void) &repl; - (void) &efp; - (void) &argc; - (void) &argv; -#endif if (hist == NULL) error("history not active"); @@ -232,19 +218,19 @@ histcmd(int argc, char **argv) */ if (lflg == 0 || editor || sflg) { lflg = 0; /* ignore */ - editfile[0] = '\0'; + editfile = NULL; /* * Catch interrupts to reset active counter and * cleanup temp files. */ + savehandler = handler; if (setjmp(jmploc.loc)) { active = 0; - if (*editfile) + if (editfile) unlink(editfile); handler = savehandler; longjmp(handler->loc, 1); } - savehandler = handler; handler = &jmploc; if (++active > MAXHISTLOOPS) { active = 0; @@ -318,9 +304,10 @@ histcmd(int argc, char **argv) if (editor) { int fd; INTOFF; /* easier */ - sprintf(editfile, "%s/_shXXXXXX", _PATH_TMP); - if ((fd = mkstemp(editfile)) < 0) + sprintf(editfilestr, "%s/_shXXXXXX", _PATH_TMP); + if ((fd = mkstemp(editfilestr)) < 0) error("can't create temporary file %s", editfile); + editfile = editfilestr; if ((efp = fdopen(fd, "w")) == NULL) { close(fd); error("can't allocate stdio buffer for temp"); diff --git a/bin/sh/parser.c b/bin/sh/parser.c index d17dc1a..54a80a7 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -898,19 +898,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) int oldstyle; char const *prevsyntax; /* syntax before arithmetic */ int synentry; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &out; - (void) "ef; - (void) &dblquote; - (void) &varnest; - (void) &arinest; - (void) &parenlevel; - (void) &oldstyle; - (void) &prevsyntax; - (void) &syntax; - (void) &synentry; -#endif startlinno = plinno; dblquote = 0; @@ -1320,13 +1307,9 @@ parsebackq: { union node *n; char *volatile str; struct jmploc jmploc; - struct jmploc *volatile savehandler; + struct jmploc *const savehandler = handler; int savelen; int saveprompt; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &saveprompt; -#endif savepbq = parsebackquote; if (setjmp(jmploc.loc)) { @@ -1343,7 +1326,6 @@ parsebackq: { str = ckmalloc(savelen); memcpy(str, stackblock(), savelen); } - savehandler = handler; handler = &jmploc; INTON; if (oldstyle) { diff --git a/bin/sh/var.c b/bin/sh/var.c index a12a568..2c1caf1 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -193,12 +193,8 @@ int setvarsafe(char *name, char *val, int flags) { struct jmploc jmploc; - struct jmploc *volatile savehandler = handler; + struct jmploc *const savehandler = handler; int err = 0; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &err; -#endif if (setjmp(jmploc.loc)) err = 1; |