From: Etienne Dechamps Date: Sun, 31 Aug 2014 12:59:30 +0000 (+0100) Subject: Fix undefined HOST_NAME_MAX on Windows. X-Git-Tag: release-1.1pre11~48 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9ad656b512582ed95a574b3fd74b948f876953ce;p=oweals%2Ftinc.git Fix undefined HOST_NAME_MAX on Windows. The Windows build was broken by commit 826ad11e419db90b66b3f76a90b54df021bb39fc which introduced a dependency on the HOST_NAME_MAX macro, which is not defined on Windows. According to MSDN for gethostname(), the maximum length of the returned string is 256 bytes (including the terminating null byte), so let's use that as a fallback. --- diff --git a/src/utils.c b/src/utils.c index 8fbc710..65ba4b9 100644 --- a/src/utils.c +++ b/src/utils.c @@ -191,6 +191,11 @@ bool check_id(const char *id) { return true; } +/* Windows doesn't define HOST_NAME_MAX. */ +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + char *replace_name(const char *name) { char *ret_name;