musl: hostname-util: introduce LINUX_HOST_NAME_MAX

glibc defines HOST_NAME_MAX as 64 and our code rely on that, but musl
defines the constant as 255. Let's provide our own definition for the
maximum length.
This commit is contained in:
Yu Watanabe
2025-11-13 08:02:05 +09:00
parent e1ddcb1125
commit 5bb9063505
5 changed files with 12 additions and 13 deletions
+3
View File
@@ -4,6 +4,9 @@
#include "basic-forward.h"
#include "strv.h"
/* HOST_NAME_MAX should be 64 on linux, but musl uses the one by POSIX (255). */
#define LINUX_HOST_NAME_MAX CONST_MIN((size_t) HOST_NAME_MAX, (size_t) 64)
char* get_default_hostname_raw(void);
bool valid_ldh_char(char c) _const_;