mirror of
https://github.com/X11Libre/xserver.git
synced 2026-03-24 08:04:30 +00:00
os: xtrans: _XSERVTransGetHostname() variant for mingw target
Win32 does not have utsname(), but gethostname(), so we need a separate implementation of _XSERVTransGetHostname() here. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
3ac1db8b5e
commit
a317ae39ad
17
os/Xtrans.c
17
os/Xtrans.c
@@ -53,7 +53,6 @@ from The Open Group.
|
||||
#ifdef HAVE_SYSTEMD_DAEMON
|
||||
#include <systemd/sd-daemon.h>
|
||||
#endif
|
||||
#include <sys/utsname.h>
|
||||
|
||||
/*
|
||||
* The transport table contains a definition for every transport (protocol)
|
||||
@@ -1136,8 +1135,20 @@ static int _XSERVTransWriteV (XtransConnInfo ciptr, struct iovec *iov, int iovcn
|
||||
return total;
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
/*
|
||||
* _XSERVTransGetHostname - similar to gethostname but allows special processing.
|
||||
*/
|
||||
int _XSERVTransGetHostname (char *buf, int maxlen)
|
||||
{
|
||||
buf[0] = '\0';
|
||||
(void) gethostname (buf, maxlen);
|
||||
buf [maxlen - 1] = '\0';
|
||||
return strlen(buf);
|
||||
}
|
||||
|
||||
#else /* WIN32 */
|
||||
|
||||
#include <sys/utsname.h>
|
||||
|
||||
/*
|
||||
* _XSERVTransGetHostname - similar to gethostname but allows special processing.
|
||||
@@ -1153,3 +1164,5 @@ int _XSERVTransGetHostname (char *buf, int maxlen)
|
||||
buf[len] = '\0';
|
||||
return len;
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
Reference in New Issue
Block a user