From 8687dae0ca26e1ab0a0c1893675668b49abccf63 Mon Sep 17 00:00:00 2001 From: nipos Date: Sat, 25 Feb 2023 19:03:40 +0100 Subject: [PATCH] LibCore: Use non-const char * for sethostname on Solaris --- Userland/Libraries/LibCore/System.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index bd60d29997..e80d0e1460 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -576,7 +576,11 @@ ErrorOr gethostname() ErrorOr sethostname(StringView hostname) { +#if defined(AK_OS_SOLARIS) + int rc = ::sethostname(const_cast(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 {};