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 localedef during
the bootstrap build, since it assumes the return value is always
a mutable pointer.
This code can modify either a const (rodata) string, which happens
to be avoided by accident, or modify const global data. Change the
logic to instead create a local copy of the string and modify that
if needed. This introduces an additional allocation, but this is
not performance-sensitive code.
MFC after: 1 week
Sponsored by: The FreeBSD Foundation