* [PATCH 1/5] vpn: Fix issue with const return value from strrchr
@ 2026-02-12 13:25 Rudi Heitbaum
0 siblings, 0 replies; only message in thread
From: Rudi Heitbaum @ 2026-02-12 13:25 UTC (permalink / raw)
To: connman; +Cc: rudi
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/vpn.c: In function 'get_ident': ../plugins/vpn.c:170:13: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 170 | pos = strrchr(path, '/'); | ^
---
plugins/vpn.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/plugins/vpn.c b/plugins/vpn.c
index 332d8e83..1a6b0194 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -160,9 +160,9 @@ static const char *get_string(struct connman_provider *provider,
return g_hash_table_lookup(data->setting_strings, key);
}
-static char *get_ident(const char *path)
+static const char *get_ident(const char *path)
{
- char *pos;
+ const char *pos;
if (*path != '/')
return NULL;
@@ -665,7 +665,7 @@ static void add_connection(const char *path, DBusMessageIter *properties,
{
struct connection_data *data;
int err;
- char *ident = get_ident(path);
+ const char *ident = get_ident(path);
bool found = false;
data = g_hash_table_lookup(vpn_connections, ident);
@@ -1092,7 +1092,7 @@ static void configuration_create_reply(DBusPendingCall *call, void *user_data)
DBusMessageIter iter;
const char *signature = DBUS_TYPE_OBJECT_PATH_AS_STRING;
const char *path;
- char *ident;
+ const char *ident;
struct connection_data *data;
struct config_create_data *cb_data = user_data;
--
2.51.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-12 13:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 13:25 [PATCH 1/5] vpn: Fix issue with const return value from strrchr Rudi Heitbaum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox