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:
tg
2007-05-13 17:51:24 +00:00
parent d2d035355f
commit 0989f7da67
13 changed files with 91 additions and 74 deletions

9
sh.h
View File

@@ -8,7 +8,7 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.128 2007/05/10 19:08:48 tg Exp $"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.129 2007/05/13 17:51:23 tg Exp $"
#define MKSH_VERSION "R29 2007/05/10"
#if HAVE_SYS_PARAM_H
@@ -1344,8 +1344,11 @@ void warningf(bool, const char *, ...)
__attribute__((format (printf, 2, 3)));
void bi_errorf(const char *, ...)
__attribute__((format (printf, 1, 2)));
void internal_errorf(int, const char *, ...)
__attribute__((format (printf, 2, 3)));
void internal_errorf(const char *, ...)
__attribute__((noreturn))
__attribute__((format (printf, 1, 2)));
void internal_warningf(const char *, ...)
__attribute__((format (printf, 1, 2)));
void error_prefix(bool);
void shellf(const char *, ...)
__attribute__((format (printf, 1, 2)));