blob: 1d04aa822b7dfe2f1e0828ed9f3111df8494652c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
$NetBSD: patch-ai,v 1.2 2005/05/29 14:38:33 wiz Exp $
--- glunix/src/util/cutil.cc.orig 1997-09-05 21:30:13.000000000 +0200
+++ glunix/src/util/cutil.cc
@@ -82,7 +82,11 @@
#define __THIS_MODULE MODULE_UTIL
#include <stdio.h>
+#ifndef __NetBSD__
#include <sys/systeminfo.h>
+#else
+#include <unistd.h>
+#endif
#include <string.h>
#include <errno.h>
@@ -137,11 +141,17 @@ Util_GetMyHostName(void)
if (init) {
return hostname;
}
-
+#ifdef __NetBSD__
+ if (gethostname(hostname,sizeof(hostname)-1) < 0) {
+ DE("Hostname: %s\n",strerror(errno));
+ return NULL;
+ }
+#else
if (sysinfo(SI_HOSTNAME, hostname, sizeof(hostname)-1) < 0) {
DE("sysinfo(SI_HOSTNAME): %s\n", strerror(errno));
return NULL;
}
+#endif
init = True;
return hostname;
}
|