Fix undefined HOST_NAME_MAX on Windows.
authorEtienne Dechamps <etienne@edechamps.fr>
Sun, 31 Aug 2014 12:59:30 +0000 (13:59 +0100)
committerEtienne Dechamps <etienne@edechamps.fr>
Sun, 31 Aug 2014 12:59:30 +0000 (13:59 +0100)
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.

src/utils.c

index 8fbc7108e9a3ffe8536b317e201fd5f5595566a0..65ba4b90402bc0df2df50fccf2f3e618c6e37597 100644 (file)
@@ -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;