aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2026-08-03 14:06:18 +0000
committerLexi Winter <ivy@FreeBSD.org>2026-08-03 14:06:18 +0000
commit78f842dda35b7280e8682f90506ff05b591c6b3a (patch)
treec4faebdd18a2c9f0194aa925f51c50754e9d49e4
parentbcee560d390eb8aa8fd0f08a7a0bffb6e77fffc6 (diff)
sort: Const correctness for C23
On some platforms, e.g. Linux Clang 22.1.8 / glibc 2.43, strchr() now implements the C23 behaviour where passing a const pointer to strchr() also returns a const pointer. This breaks sort during the bootstrap build, since it assumes the return value is always a mutable pointer. As the returned pointer is never used to modify the value, fix this by making the temporary variable const. MFC after: 1 week Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D58491
-rw-r--r--usr.bin/sort/sort.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c
index 6e4023c43063..422884573ae9 100644
--- a/usr.bin/sort/sort.c
+++ b/usr.bin/sort/sort.c
@@ -735,7 +735,7 @@ parse_k(const char *s, struct key_specs *ks)
{ false, false, false, false, false, false };
if (s && *s) {
- char *sptr;
+ const char *sptr;
sptr = strchr(s, ',');
if (sptr) {