Skip to content

Commit

Permalink
macOS: Remove .local suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesLorenz committed Dec 3, 2023
1 parent 2ee7c8f commit c24453d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,14 @@ void lo_server_resolve_hostname(lo_server s)
s->hostname = strdup(hostname);
#ifdef __APPLE__
/* On macOS, capital hostnames cause issues in DNS resolving */
for (char* p = s->hostname; *p; ++p)
size_t slen = 0;
for (char* p = s->hostname; *p; ++p, ++slen) {
*p = tolower(*p);
}
/* On macOS, an appendix ".local" can cause issues */
char* local_suffix = s->hostname + slen - 6;
if(!strncmp(local_suffix, ".local",6))
*local_suffix = 0;
#endif
}

Expand Down

0 comments on commit c24453d

Please sign in to comment.