Skip to content

Commit

Permalink
HOST_NAME_MAX -> _POSIX_HOST_NAME_MAX
Browse files Browse the repository at this point in the history
Apparently HOST_NAME_MAX is not defined on MacOS, see #7.

Also see oils-for-unix/oils#1656
  • Loading branch information
vimpostor committed Jun 27, 2024
1 parent ec2aff3 commit bf1d033
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ QString Remote::get_local_domain() {
#ifndef Q_OS_UNIX
return {};
#else
char host[HOST_NAME_MAX];
if (gethostname(host, HOST_NAME_MAX)) {
char host[_POSIX_HOST_NAME_MAX];
if (gethostname(host, _POSIX_HOST_NAME_MAX)) {
std::cerr << "gethostname failed" << std::endl;
return {};
}
Expand All @@ -70,7 +70,7 @@ QString Remote::get_local_domain() {
const auto fqdn = res->ai_canonname;
std::string result;

if (!strncmp(fqdn, host, HOST_NAME_MAX)) {
if (!strncmp(fqdn, host, _POSIX_HOST_NAME_MAX)) {
std::cerr << "failed to retreive a proper FQDN for " << host << std::endl;
} else {
result = fqdn;
Expand Down

0 comments on commit bf1d033

Please sign in to comment.