mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Unix platform_make_x11_server: fix sense of error check.
Analogous to the bug I just fixed in xtruss: in the loop that tries to find a reasonable port number for an X display, the sense of the (horrible) strcmp distinguishing EADDRINUSE from other socket errors was backwards.
This commit is contained in:
parent
5c09c1c47e
commit
bff0c590e5
15
unix/x11.c
15
unix/x11.c
@ -88,7 +88,20 @@ int platform_make_x11_server(Plug *plug, const char *progname, int mindisp,
|
|||||||
sk_close(sockets[nsockets]);
|
sk_close(sockets[nsockets]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(err, strerror(EADDRINUSE))) /* yuck! */
|
/*
|
||||||
|
* If we weren't able to bind to this port because it's in use
|
||||||
|
* by another program, go round this loop and try again. But
|
||||||
|
* for any other reason, give up completely and return failure
|
||||||
|
* to our caller.
|
||||||
|
*
|
||||||
|
* sk_socket_error currently has no machine-readable component
|
||||||
|
* (it would need a cross-platform abstraction of the socket
|
||||||
|
* error types we care about, plus translation from each OS
|
||||||
|
* error enumeration into that). So we use the disgusting
|
||||||
|
* approach of a string compare between the error string and
|
||||||
|
* the one EADDRINUSE would have given :-(
|
||||||
|
*/
|
||||||
|
if (strcmp(err, strerror(EADDRINUSE)))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user