From 030046a2a81213921d9ad61b102f63343a9a4e57 Mon Sep 17 00:00:00 2001 From: Jacob Nevins Date: Mon, 5 Jan 2009 01:01:58 +0000 Subject: [PATCH] Cope with a (non-standard) ENAMETOOLONG return from gethostname(); glibc will do this if the supplied buffer isn't big enough, which shouldn't lead to complete abandonment of X11 auth. (Would only have bitten with hostnames >255 chars anyway.) [originally from svn r8383] --- unix/ux_x11.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/unix/ux_x11.c b/unix/ux_x11.c index 0998069e..4126d5b7 100644 --- a/unix/ux_x11.c +++ b/unix/ux_x11.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "putty.h" #include "ssh.h" @@ -40,7 +41,8 @@ void platform_get_x11_auth(struct X11Display *disp, const Config *cfg) do { len *= 2; disp->hostname = snewn(len, char); - if (gethostname(disp->hostname, len) < 0) { + if ((gethostname(disp->hostname, len) < 0) && + (errno != ENAMETOOLONG)) { disp->hostname = NULL; return; }