diff options
| author | Lexi Winter <ivy@FreeBSD.org> | 2026-08-03 14:07:09 +0000 |
|---|---|---|
| committer | Lexi Winter <ivy@FreeBSD.org> | 2026-08-03 14:07:09 +0000 |
| commit | 2296c39a9ebc4f081d90b6554d8839e8cde8490a (patch) | |
| tree | 9e0e69021c6f363e83e3865ac9b99755af933f2b | |
| parent | 78f842dda35b7280e8682f90506ff05b591c6b3a (diff) | |
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
| -rw-r--r-- | usr.bin/xinstall/xinstall.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |
