ConnMan network manager
 help / color / mirror / Atom feed
From: Rudi Heitbaum <rudi@heitbaum.com>
To: connman@lists.linux.dev
Cc: rudi@heitbauum.com
Subject: [PATCH 1/5] vpn: Fix issue with const return value from strrchr
Date: Thu, 12 Feb 2026 13:25:57 +0000	[thread overview]
Message-ID: <aY3U5aO25va_wuNf@01676446e9f4> (raw)

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


                 reply	other threads:[~2026-02-12 13:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aY3U5aO25va_wuNf@01676446e9f4 \
    --to=rudi@heitbaum.com \
    --cc=connman@lists.linux.dev \
    --cc=rudi@heitbauum.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox