diff --git a/os/access.c b/os/access.c index 2c5e67e94..13a352091 100644 --- a/os/access.c +++ b/os/access.c @@ -444,15 +444,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 { @@ -478,11 +470,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 3c74a2a09..cdcb89a71 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -206,4 +206,15 @@ extern void XdmcpRegisterBroadcastAddress(const struct sockaddr_in *addr); extern void XdmAuthenticationInit(const char *cookie, int cookie_length); #endif +#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_ */