fix two reported warnings with SERVER_ADMIN_MSG defined
Report stated a -Wformat-nonliteral at line 612, and a -Wformat-security at line 614 I was only seeing the latter, so I added the former to the flags in sys/unix/hints/include/compiler.370. Some compiler versions have that warning on by default internally and others don't. If the format string isn't a string literal, there's no inteference with printf argument checking because that only operates on string literals.
This commit is contained in:
+7
-1
@@ -559,6 +559,9 @@ ckmailstatus(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(SIMPLE_MAIL) || defined(SERVER_ADMIN_MSG)
|
#if defined(SIMPLE_MAIL) || defined(SERVER_ADMIN_MSG)
|
||||||
|
|
||||||
|
DISABLE_WARNING_FORMAT_NONLITERAL
|
||||||
|
|
||||||
void
|
void
|
||||||
read_simplemail(char *mbox, boolean adminmsg)
|
read_simplemail(char *mbox, boolean adminmsg)
|
||||||
{
|
{
|
||||||
@@ -611,7 +614,7 @@ read_simplemail(char *mbox, boolean adminmsg)
|
|||||||
|
|
||||||
pline(msgfrom, curline);
|
pline(msgfrom, curline);
|
||||||
if (adminmsg)
|
if (adminmsg)
|
||||||
verbalize(msg);
|
verbalize("%s", msg);
|
||||||
else
|
else
|
||||||
pline("It reads: \"%s\".", msg);
|
pline("It reads: \"%s\".", msg);
|
||||||
|
|
||||||
@@ -642,6 +645,9 @@ read_simplemail(char *mbox, boolean adminmsg)
|
|||||||
if (!adminmsg)
|
if (!adminmsg)
|
||||||
pline("It appears to be all gibberish.");
|
pline("It appears to be all gibberish.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RESTORE_WARNING_FORMAT_NONLITERAL
|
||||||
|
|
||||||
#endif /* SIMPLE_MAIL */
|
#endif /* SIMPLE_MAIL */
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ CFLAGS+=-Wall -Wextra -Wno-missing-field-initializers \
|
|||||||
CFLAGS+=-pedantic
|
CFLAGS+=-pedantic
|
||||||
CFLAGS+=-Wmissing-declarations
|
CFLAGS+=-Wmissing-declarations
|
||||||
CFLAGS+=-Wunreachable-code
|
CFLAGS+=-Wunreachable-code
|
||||||
|
CFLAGS+=-Wformat-nonliteral
|
||||||
#
|
#
|
||||||
# the following are not allowed in C++
|
# the following are not allowed in C++
|
||||||
CFLAGS+=-Wimplicit
|
CFLAGS+=-Wimplicit
|
||||||
|
|||||||
Reference in New Issue
Block a user