[PATCH 5/5] ofono: Fix issue with const return value from strrchr

Rudi Heitbaum <[email protected]> Thu, 12 Feb 2026 13:27:59 +0000
Newsgroups dev.linux.lists.connman
Message-ID <aY3VX9GIRgdwH-L3@01676446e9f4>
When compiling 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.
---
 plugins/ofono.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/ofono.c b/plugins/ofono.c
index 2deb67d2..2b51def0 100644
--- a/plugins/ofono.c
+++ b/plugins/ofono.c
@@ -186,9 +186,9 @@ static const char *api2string(enum ofono_api api)
 	return "unknown";
 }
 
-static char *get_ident(const char *path)
+static const char *get_ident(const char *path)
 {
-	char *pos;
+	const char *pos;
 
 	if (*path != '/')
 		return NULL;
-- 
2.51.0