summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
4c5b873)
treat all socket closures as clean exits (because the protocol doesn't
provide for transferring a process exit code) could usefully at least
treat _socket errors_ as unclean exits. Patch the Telnet, Rlogin and
Raw backends to retain that information and return INT_MAX to the
frontend.
I wasn't sure whether it was better to solve this by modifying each
affected frontend, or each affected backend. Neither is really ideal;
this is the sort of thing that makes me wish we had a piece of fixed
middleware in between, independent of both platform and protocol.
git-svn-id: svn://svn.tartarus.org/sgt/putty@9730
cda61777-01e9-0310-a592-
d414129be87e
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
/* the above field _must_ be first in the structure */
Socket s;
/* the above field _must_ be first in the structure */
Socket s;
+ int closed_on_socket_error;
int bufsize;
void *frontend;
int sent_console_eof, sent_socket_eof;
int bufsize;
void *frontend;
int sent_console_eof, sent_socket_eof;
if (raw->s) {
sk_close(raw->s);
raw->s = NULL;
if (raw->s) {
sk_close(raw->s);
raw->s = NULL;
+ raw->closed_on_socket_error = TRUE;
notify_remote_exit(raw->frontend);
}
logevent(raw->frontend, error_msg);
notify_remote_exit(raw->frontend);
}
logevent(raw->frontend, error_msg);
raw = snew(struct raw_backend_data);
raw->fn = &fn_table;
raw->s = NULL;
raw = snew(struct raw_backend_data);
raw->fn = &fn_table;
raw->s = NULL;
+ raw->closed_on_socket_error = FALSE;
*backend_handle = raw;
raw->sent_console_eof = raw->sent_socket_eof = FALSE;
*backend_handle = raw;
raw->sent_console_eof = raw->sent_socket_eof = FALSE;
Raw raw = (Raw) handle;
if (raw->s != NULL)
return -1; /* still connected */
Raw raw = (Raw) handle;
if (raw->s != NULL)
return -1; /* still connected */
+ else if (raw->closed_on_socket_error)
+ return INT_MAX; /* a socket error counts as an unclean exit */
else
/* Exit codes are a meaningless concept in the Raw protocol */
return 0;
else
/* Exit codes are a meaningless concept in the Raw protocol */
return 0;
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "putty.h"
#include <ctype.h>
#include "putty.h"
/* the above field _must_ be first in the structure */
Socket s;
/* the above field _must_ be first in the structure */
Socket s;
+ int closed_on_socket_error;
int bufsize;
int firstbyte;
int cansize;
int bufsize;
int firstbyte;
int cansize;
if (rlogin->s) {
sk_close(rlogin->s);
rlogin->s = NULL;
if (rlogin->s) {
sk_close(rlogin->s);
rlogin->s = NULL;
+ if (error_msg)
+ rlogin->closed_on_socket_error = TRUE;
notify_remote_exit(rlogin->frontend);
}
if (error_msg) {
notify_remote_exit(rlogin->frontend);
}
if (error_msg) {
rlogin = snew(struct rlogin_tag);
rlogin->fn = &fn_table;
rlogin->s = NULL;
rlogin = snew(struct rlogin_tag);
rlogin->fn = &fn_table;
rlogin->s = NULL;
+ rlogin->closed_on_socket_error = FALSE;
rlogin->frontend = frontend_handle;
rlogin->term_width = conf_get_int(conf, CONF_width);
rlogin->term_height = conf_get_int(conf, CONF_height);
rlogin->frontend = frontend_handle;
rlogin->term_width = conf_get_int(conf, CONF_width);
rlogin->term_height = conf_get_int(conf, CONF_height);
Rlogin rlogin = (Rlogin) handle;
if (rlogin->s != NULL)
return -1; /* still connected */
Rlogin rlogin = (Rlogin) handle;
if (rlogin->s != NULL)
return -1; /* still connected */
+ else if (rlogin->closed_on_socket_error)
+ return INT_MAX; /* a socket error counts as an unclean exit */
else
/* If we ever implement RSH, we'll probably need to do this properly */
return 0;
else
/* If we ever implement RSH, we'll probably need to do this properly */
return 0;
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
/* the above field _must_ be first in the structure */
Socket s;
/* the above field _must_ be first in the structure */
Socket s;
+ int closed_on_socket_error;
void *frontend;
void *ldisc;
void *frontend;
void *ldisc;
if (telnet->s) {
sk_close(telnet->s);
telnet->s = NULL;
if (telnet->s) {
sk_close(telnet->s);
telnet->s = NULL;
+ if (error_msg)
+ telnet->closed_on_socket_error = TRUE;
notify_remote_exit(telnet->frontend);
}
if (error_msg) {
notify_remote_exit(telnet->frontend);
}
if (error_msg) {
telnet->fn = &fn_table;
telnet->conf = conf_copy(conf);
telnet->s = NULL;
telnet->fn = &fn_table;
telnet->conf = conf_copy(conf);
telnet->s = NULL;
+ telnet->closed_on_socket_error = FALSE;
telnet->echoing = TRUE;
telnet->editing = TRUE;
telnet->activated = FALSE;
telnet->echoing = TRUE;
telnet->editing = TRUE;
telnet->activated = FALSE;
Telnet telnet = (Telnet) handle;
if (telnet->s != NULL)
return -1; /* still connected */
Telnet telnet = (Telnet) handle;
if (telnet->s != NULL)
return -1; /* still connected */
+ else if (telnet->closed_on_socket_error)
+ return INT_MAX; /* a socket error counts as an unclean exit */
else
/* Telnet doesn't transmit exit codes back to the client */
return 0;
else
/* Telnet doesn't transmit exit codes back to the client */
return 0;