X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/984992ef01577c0c12cdb5f404ea91d3954264ae..d9c40fd6ed72588278c633ee5db5c2eefad6ba7c:/unix/uxplink.c diff --git a/unix/uxplink.c b/unix/uxplink.c index 453a9f41..ba7b78f9 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -111,6 +111,9 @@ void try_output(int is_stderr) void *senddata; int sendlen, ret; + if (bufchain_size(chain) == 0) + return; + bufchain_prefix(chain, &senddata, &sendlen); ret = write(fd, senddata, sendlen); if (ret > 0) @@ -532,12 +535,17 @@ int main(int argc, char **argv) for (i = 0; i < skcount; i++) { socket = sklist[i]; + /* + * We must process exceptional notifications before + * ordinary readability ones, or we may go straight + * past the urgent marker. + */ + if (FD_ISSET(socket, &xset)) + select_result(socket, 4); if (FD_ISSET(socket, &rset)) select_result(socket, 1); if (FD_ISSET(socket, &wset)) select_result(socket, 2); - if (FD_ISSET(socket, &xset)) - select_result(socket, 4); } if (FD_ISSET(0, &rset)) { @@ -576,5 +584,6 @@ int main(int argc, char **argv) fprintf(stderr, "Remote process exit code unavailable\n"); exitcode = 1; /* this is an error condition */ } - return exitcode; + cleanup_exit(exitcode); + return exitcode; /* shouldn't happen, but placates gcc */ }