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.)
git-svn-id: svn://svn.tartarus.org/sgt/putty@8383
cda61777-01e9-0310-a592-
d414129be87e
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
+#include <errno.h>
#include "putty.h"
#include "ssh.h"
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;
}