diff --git a/os/access.c b/os/access.c index 6b3cad4ca..cf784248d 100644 --- a/os/access.c +++ b/os/access.c @@ -446,15 +446,7 @@ DefineSelf(int fd) caddr_t addr; int family; register HOST *host; - -#ifndef WIN32 struct utsname name; -#else - struct { - char nodename[512]; - } name; -#endif - register struct hostent *hp; union { @@ -480,11 +472,7 @@ DefineSelf(int fd) * uname() lets me access to the whole string (it smashes release, you * see), whereas gethostname() kindly truncates it for me. */ -#ifndef WIN32 uname(&name); -#else - gethostname(name.nodename, sizeof(name.nodename)); -#endif hp = _XGethostbyname(name.nodename, hparams); if (hp != NULL) { diff --git a/os/osdep.h b/os/osdep.h index f5ad07705..385eddc44 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -133,4 +133,15 @@ extern void GenerateRandomData(int len, char *buf); void TimerInit(void); Bool TimerForce(OsTimerPtr timer); +#ifdef WIN32 +#include +struct utsname { + char nodename[512]; +}; + +static inline void uname(struct utsname *uts) { + gethostname(uts->nodename, sizeof(uts->nodename)); +} +#endif /* WIN32 */ + #endif /* _OSDEP_H_ */