From: Bastien Nocera <hadess@hadess.net>
To: linux-bluetooth@vger.kernel.org
Subject: [BlueZ 3/3] mesh: Fix const qualifier dropping when using strchr()
Date: Mon, 11 May 2026 13:35:07 +0200 [thread overview]
Message-ID: <20260511113511.1217887-3-hadess@hadess.net> (raw)
In-Reply-To: <20260511113511.1217887-1-hadess@hadess.net>
strchr() with a const string returns a const string, we don't change
that string or "next", so make both const and get rid of the warning.
mesh/util.c: In function ‘create_dir’:
mesh/util.c:108:14: error: assignment discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
108 | prev = strchr(dir_name, '/');
| ^
---
mesh/util.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mesh/util.c b/mesh/util.c
index 348401ae5582..a21882a2d9f0 100644
--- a/mesh/util.c
+++ b/mesh/util.c
@@ -95,7 +95,8 @@ size_t hex2str(const uint8_t *in, size_t in_len, char *out, size_t out_len)
int create_dir(const char *dir_name)
{
struct stat st;
- char dir[PATH_MAX + 1], *prev, *next;
+ const char *prev, *next;
+ char dir[PATH_MAX + 1];
int err;
err = stat(dir_name, &st);
--
2.54.0
next prev parent reply other threads:[~2026-05-11 11:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 11:35 [BlueZ 1/3] mesh: Remove unused but set variable Bastien Nocera
2026-05-11 11:35 ` [BlueZ 2/3] mesh: Fix str{r,}chr usage Bastien Nocera
2026-05-11 11:35 ` Bastien Nocera [this message]
2026-05-11 14:27 ` [BlueZ,1/3] mesh: Remove unused but set variable bluez.test.bot
2026-05-12 19:20 ` [BlueZ 1/3] " patchwork-bot+bluetooth
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=20260511113511.1217887-3-hadess@hadess.net \
--to=hadess@hadess.net \
--cc=linux-bluetooth@vger.kernel.org \
/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