LibCore: Use non-const char * for sethostname on Solaris

This commit is contained in:
nipos 2023-02-25 19:03:40 +01:00 committed by Andrew Kaster
parent cdd1c8d0d9
commit 8687dae0ca
Notes: sideshowbarker 2024-07-19 16:55:29 +09:00

View file

@ -576,7 +576,11 @@ ErrorOr<DeprecatedString> gethostname()
ErrorOr<void> sethostname(StringView hostname)
{
#if defined(AK_OS_SOLARIS)
int rc = ::sethostname(const_cast<char*>(hostname.characters_without_null_termination()), hostname.length());
#else
int rc = ::sethostname(hostname.characters_without_null_termination(), hostname.length());
#endif
if (rc < 0)
return Error::from_syscall("sethostname"sv, -errno);
return {};