Bug with iwd-3.11 - const char being modified

Rudi Heitbaum
2026-02-09T20:59:54Z

Bug report (as below) for current iwd (including 3.11) - const char being modified.

When compiling iwd with recent gcc and glibc-2.43 the --Wdiscarded-qualifiers
warning occurs because with ISO C23, the function strrrchr that return
pointers into their input arrays now have definitions as macros that
return a pointer to a const-qualified type when the input argument is
a pointer to a const-qualified type.

../client/known-networks.c: In function 'known_network_proxy_find_by_name':
../client/known-networks.c:296:29: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
296 | char *dot = strrchr(name, '.');
| ^~~~~~~

The fix would be to declare dot as const char as below, but this surfaces
the error that name (which is const) is being modified. See >>>> below -
this being an error.

Regards
Rudi

--- a/client/known-networks.c
+++ b/client/known-networks.c
@@ -293,13 +293,13 @@
network_args.type = NULL;

if (network_args.type) {
- char *dot = strrchr(name, '.');
+ const char *dot = strrchr(name, '.');

if (!dot)
/* This shouldn't ever be the case */
return NULL;

>>>> *dot = '\0';
}

network_args.name = name;