Fix for Coverity CID#2: false bug, but still a problem.
Analysis: internal_errorf(int, fmt, ...) was only a __dead function if the int argument was non-0, which the Prevent probably was unable to follow. Change all uses of internal_errorf(0, fmt, ...) to internal_warningf(fmt, ...); change the pro- totype of internal_errorf() to internal_errorf(fmt, ...) and all remaining uses remove the non-0 int argument; add __dead to internal_errorf() proto; flesh out guts of internal_errorf() and internal_warningf() into a new local function for optimisation purposes. Some whitespace cleanup and dead code removal (return after internal_errorf(1))
This commit is contained in:
10
exec.c
10
exec.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.29 2007/04/18 00:59:20 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.30 2007/05/13 17:51:21 tg Exp $");
|
||||
|
||||
static int comexec(struct op *, struct tbl *volatile, const char **,
|
||||
int volatile);
|
||||
@ -617,7 +617,7 @@ comexec(struct op *t, struct tbl *volatile tp, const char **ap,
|
||||
/* NOTREACHED */
|
||||
default:
|
||||
quitenv(NULL);
|
||||
internal_errorf(1, "CFUNC %d", i);
|
||||
internal_errorf("CFUNC %d", i);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -756,7 +756,7 @@ shcomexec(const char **wp)
|
||||
|
||||
tp = ktsearch(&builtins, *wp, hash(*wp));
|
||||
if (tp == NULL)
|
||||
internal_errorf(1, "shcomexec: %s", *wp);
|
||||
internal_errorf("shcomexec: %s", *wp);
|
||||
return (call_builtin(tp, wp));
|
||||
}
|
||||
|
||||
@ -1236,7 +1236,7 @@ herein(const char *content, int sub)
|
||||
s->start = s->str = content;
|
||||
source = s;
|
||||
if (yylex(ONEWORD|HEREDOC) != LWORD)
|
||||
internal_errorf(1, "herein: yylex");
|
||||
internal_errorf("herein: yylex");
|
||||
source = osource;
|
||||
shf_puts(evalstr(yylval.cp, 0), shf);
|
||||
} else
|
||||
@ -1459,5 +1459,5 @@ static void
|
||||
dbteste_error(Test_env *te, int offset, const char *msg)
|
||||
{
|
||||
te->flags |= TEF_ERROR;
|
||||
internal_errorf(0, "dbteste_error: %s (offset %d)", msg, offset);
|
||||
internal_warningf("dbteste_error: %s (offset %d)", msg, offset);
|
||||
}
|
||||
|
Reference in New Issue
Block a user