Skip to contentSkip to conversation

xshared: fix discards 'const' qualifier

PATCH New Rudi Heitbaum 1 participant 1 message Feb 20 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 xshared: fix discards 'const' qualifier

argv is passed by parse_change_counters_rule and do_parse to parse_rule_range as a const char. parse_rule_range modifies thepassed in argv, so pass as non const so that it can be modified without warning.

Fixes:
iptables/xshared.c: In function 'parse_rule_range':
iptables/xshared.c:912:23: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
912 | char *colon = strchr(argv, ':'), *buffer;
| ^~~~~~

---
 iptables/xshared.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/xshared.c +1 -1
index b941b8df..26e91e37 100644
@@ -907,7 +907,7 @@ static int parse_rulenumber(const char *rule)
 	return rulenum;
 }
 
-static void parse_rule_range(struct xt_cmd_parse *p, const char *argv)
+static void parse_rule_range(struct xt_cmd_parse *p, char *argv)
 {
 	char *colon = strchr(argv, ':'), *buffer;
 
Signature · 1 line
2.51.0