public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* Bug with iwd-3.11 - const char being modified
@ 2026-02-09 20:59 Rudi Heitbaum
  2026-02-10  9:34 ` Marcel Holtmann
  0 siblings, 1 reply; 2+ messages in thread
From: Rudi Heitbaum @ 2026-02-09 20:59 UTC (permalink / raw)
  To: iwd; +Cc: rudi


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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-10  9:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-09 20:59 Bug with iwd-3.11 - const char being modified Rudi Heitbaum
2026-02-10  9:34 ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox