uri: switch to conservative maximum hostname length

Current maximum is provided by sysconf(_SC_HOST_NAME_MAX) instead.

uri.c:269:20: error: use of undeclared identifier 'HOST_NAME_MAX'
    char this_host[HOST_NAME_MAX];
                   ^
This commit is contained in:
Jan Beich 2021-01-19 14:41:02 +00:00 committed by Daniel Eklöf
parent ce7df7cc1f
commit c531c6bc0e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

2
uri.c
View file

@ -266,7 +266,7 @@ err:
bool bool
hostname_is_localhost(const char *hostname) hostname_is_localhost(const char *hostname)
{ {
char this_host[HOST_NAME_MAX]; char this_host[_POSIX_HOST_NAME_MAX];
if (gethostname(this_host, sizeof(this_host)) < 0) if (gethostname(this_host, sizeof(this_host)) < 0)
this_host[0] = '\0'; this_host[0] = '\0';