1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

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]
This commit is contained in:
Jacob Nevins 2009-01-05 01:01:58 +00:00
parent 07a876ce1e
commit 030046a2a8

View File

@ -6,6 +6,7 @@
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#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;
}