X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/ffbfd0935a4a75c4e3418f1010d526fbd93139a3..0996dd4c856a3852a92cb7f17cf3fb78a286c075:/unix/uxnet.c diff --git a/unix/uxnet.c b/unix/uxnet.c index 8e95a65e..4467d082 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -1395,6 +1395,23 @@ int net_service_lookup(char *service) return 0; } +char *get_hostname(void) +{ + int len = 128; + char *hostname = NULL; + do { + len *= 2; + hostname = sresize(hostname, len, char); + if ((gethostname(hostname, len) < 0) && + (errno != ENAMETOOLONG)) { + sfree(hostname); + hostname = NULL; + break; + } + } while (strlen(hostname) >= len-1); + return hostname; +} + SockAddr platform_get_x11_unix_address(const char *sockpath, int displaynum) { SockAddr ret = snew(struct SockAddr_tag);