git: 2296c39a9ebc - main - xinstall: Const correctness for C23
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 03 Aug 2026 14:30:45 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=2296c39a9ebc4f081d90b6554d8839e8cde8490a
commit 2296c39a9ebc4f081d90b6554d8839e8cde8490a
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2026-08-03 14:07:09 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2026-08-03 14:07:09 +0000
xinstall: 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 xinstall 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: ray, markj, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58492
---
usr.bin/xinstall/xinstall.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index 7636da20153b..36af3528cae6 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -819,7 +819,8 @@ install(const char *from_name, const char *to_name, u_long fset, u_int flags)
char backup[MAXPATHLEN], pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
struct stat from_sb, temp_sb, to_sb;
struct timespec tsb[2];
- char *digestresult, *p;
+ char *digestresult;
+ const char *p;
int from_fd, temp_fd, to_fd, serrno;
bool devnull, exists, files_match, ispipe, stripped;