Allows GCC to check the formats by switching to a define, which is a
constant expression.

Fixes:

warning: format not a string literal, argument types not checked
[-Wformat-nonliteral]
  207 |  snprintf(buf, sizeof(buf), tmpl, include->path);

Signed-off-by: Rosen Penev <[email protected]>
---
 includes.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/includes.c b/includes.c
index 23b2244..1e759fb 100644
--- a/includes.c
+++ b/includes.c
@@ -188,11 +188,11 @@ run_include(struct fw3_include *include)
 {
        int rv;
        struct stat s;
-       const char *tmpl =
-               "config() { "
-                       "echo \"You cannot use UCI in firewall includes!\" >&2; 
"
-                       "exit 1; "
-               "}; . %s";
+       #define tmpl \
+               "config() { " \
+                       "echo \"You cannot use UCI in firewall includes!\" >&2; 
" \
+                       "exit 1; " \
+               "}; . %s"
 
        char buf[PATH_MAX + sizeof(tmpl)];
 
-- 
2.23.0


_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to