1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:07:45 +00:00

LookupServer: Use _POSIX_HOST_NAME_MAX instead of HOST_NAME_MAX

HOST_NAME_MAX is not defined on the BSDs, including macOS. Use
_POSIX_HOST_NAME_MAX instead, which is defined on all the platforms.
This commit is contained in:
Timon Kruiper 2022-07-05 16:19:57 +02:00 committed by Andreas Kling
parent 579eb7cf41
commit 2b82c83ceb
2 changed files with 2 additions and 2 deletions

View file

@ -126,7 +126,7 @@ void LookupServer::load_etc_hosts()
static String get_hostname() static String get_hostname()
{ {
char buffer[HOST_NAME_MAX]; char buffer[_POSIX_HOST_NAME_MAX];
VERIFY(gethostname(buffer, sizeof(buffer)) == 0); VERIFY(gethostname(buffer, sizeof(buffer)) == 0);
return buffer; return buffer;
} }

View file

@ -22,7 +22,7 @@ MulticastDNS::MulticastDNS(Object* parent)
: Core::UDPServer(parent) : Core::UDPServer(parent)
, m_hostname("courage.local") , m_hostname("courage.local")
{ {
char buffer[HOST_NAME_MAX]; char buffer[_POSIX_HOST_NAME_MAX];
if (gethostname(buffer, sizeof(buffer)) < 0) { if (gethostname(buffer, sizeof(buffer)) < 0) {
perror("gethostname"); perror("gethostname");
} else { } else {