[Drbd-dev] [PATCH drbd-utils] Fix drbdsetup-8.4 build with -Werror=format-security
Apollon Oikonomopoulos
apoikos at debian.org
Wed May 28 09:47:53 CEST 2014
Building drbdsetup-8.4 with -Werror=format-security (enabled by default
for Debian builds) currently fails with the following errors:
drbdsetup.c: In function ‘print_command_usage’:
drbdsetup.c:2311:6: error: format not a string literal and no format arguments [-Werror=format-security]
wrap_printf(4, "|resource" + first);
^
drbdsetup.c:2315:6: error: format not a string literal and no format arguments [-Werror=format-security]
wrap_printf(4, "|minor" + first);
^
drbdsetup.c:2319:6: error: format not a string literal and no format arguments [-Werror=format-security]
wrap_printf(4, "|all" + first);
^
cc1: some warnings being treated as errors
<builtin>: recipe for target 'drbdsetup.o' failed
Note that the way wrap_printf is called in this case is indeed safe, however we
comply with gcc by adding a "%s" format string to these calls.
Signed-off-by: Apollon Oikonomopoulos <apoikos at debian.org>
---
user/legacy-84/drbdsetup.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/user/legacy-84/drbdsetup.c b/user/legacy-84/drbdsetup.c
index 99d23b4..c8a5ee0 100644
--- a/user/legacy-84/drbdsetup.c
+++ b/user/legacy-84/drbdsetup.c
@@ -2308,15 +2308,15 @@ static void print_command_usage(struct drbd_cmd *cm, enum usage_type ut)
wrap_printf(4, " {");
if (ctx & CTX_RESOURCE) {
- wrap_printf(4, "|resource" + first);
+ wrap_printf(4, "%s", "|resource" + first);
first = false;
}
if (ctx & CTX_MINOR) {
- wrap_printf(4, "|minor" + first);
+ wrap_printf(4, "%s", "|minor" + first);
first = false;
}
if (ctx & CTX_ALL) {
- wrap_printf(4, "|all" + first);
+ wrap_printf(4, "%s", "|all" + first);
first = false;
}
wrap_printf(4, "}");
--
2.0.0.rc2
More information about the drbd-dev
mailing list