mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05: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:
parent
07a876ce1e
commit
030046a2a8
@ -6,6 +6,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "putty.h"
|
#include "putty.h"
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
@ -40,7 +41,8 @@ void platform_get_x11_auth(struct X11Display *disp, const Config *cfg)
|
|||||||
do {
|
do {
|
||||||
len *= 2;
|
len *= 2;
|
||||||
disp->hostname = snewn(len, char);
|
disp->hostname = snewn(len, char);
|
||||||
if (gethostname(disp->hostname, len) < 0) {
|
if ((gethostname(disp->hostname, len) < 0) &&
|
||||||
|
(errno != ENAMETOOLONG)) {
|
||||||
disp->hostname = NULL;
|
disp->hostname = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user