From: simon Date: Sun, 4 May 2003 14:14:10 +0000 (+0000) Subject: Colin's and my fixes to connection_fatal(). X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/971bcc0afc69f7e754285167e88885c8893d0229 Colin's and my fixes to connection_fatal(). git-svn-id: svn://svn.tartarus.org/sgt/putty@3161 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/raw.c b/raw.c index 10e9ce64..e7a159cd 100644 --- a/raw.c +++ b/raw.c @@ -41,7 +41,7 @@ static int raw_closing(Plug plug, char *error_msg, int error_code, if (error_msg) { /* A socket error has occurred. */ logevent(raw->frontend, error_msg); - connection_fatal("%s", error_msg); + connection_fatal(raw->frontend, "%s", error_msg); } /* Otherwise, the remote side closed the connection normally. */ return 0; } diff --git a/rlogin.c b/rlogin.c index c12a0802..aa8dc0dd 100644 --- a/rlogin.c +++ b/rlogin.c @@ -43,7 +43,7 @@ static int rlogin_closing(Plug plug, char *error_msg, int error_code, if (error_msg) { /* A socket error has occurred. */ logevent(rlogin->frontend, error_msg); - connection_fatal("%s", error_msg); + connection_fatal(rlogin->frontend, "%s", error_msg); } /* Otherwise, the remote side closed the connection normally. */ return 0; } diff --git a/ssh.c b/ssh.c index 81ca0c87..11683c0e 100644 --- a/ssh.c +++ b/ssh.c @@ -2085,7 +2085,7 @@ static int ssh_closing(Plug plug, char *error_msg, int error_code, if (error_msg) { /* A socket error has occurred. */ logevent(error_msg); - connection_fatal(ssh->frontend, error_msg); + connection_fatal(ssh->frontend, "%s", error_msg); } else { /* Otherwise, the remote side closed the connection normally. */ } diff --git a/telnet.c b/telnet.c index e3fff49f..d358f82f 100644 --- a/telnet.c +++ b/telnet.c @@ -643,7 +643,7 @@ static int telnet_closing(Plug plug, char *error_msg, int error_code, if (error_msg) { /* A socket error has occurred. */ logevent(telnet->frontend, error_msg); - connection_fatal("%s", error_msg); + connection_fatal(telnet->frontend, "%s", error_msg); } /* Otherwise, the remote side closed the connection normally. */ return 0; } diff --git a/window.c b/window.c index 32ed507f..6d306f56 100644 --- a/window.c +++ b/window.c @@ -930,13 +930,15 @@ void set_raw_mouse_mode(void *frontend, int activate) void connection_fatal(void *frontend, char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Fatal Error", appname); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); + sfree(stuff); + if (cfg.close_on_exit == FORCE_ON) PostQuitMessage(1); else { @@ -953,13 +955,14 @@ void connection_fatal(void *frontend, char *fmt, ...) void cmdline_error(char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Command Line Error", appname); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); + sfree(stuff); exit(1); } @@ -4302,13 +4305,14 @@ void optimised_move(void *frontend, int to, int from, int lines) void fatalbox(char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Fatal Error", appname); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); + sfree(stuff); cleanup_exit(1); } @@ -4318,14 +4322,15 @@ void fatalbox(char *fmt, ...) void modalfatalbox(char *fmt, ...) { va_list ap; - char stuff[200], morestuff[100]; + char *stuff, morestuff[100]; va_start(ap, fmt); - vsprintf(stuff, fmt, ap); + stuff = dupvprintf(fmt, ap); va_end(ap); sprintf(morestuff, "%.70s Fatal Error", appname); MessageBox(hwnd, stuff, morestuff, MB_SYSTEMMODAL | MB_ICONERROR | MB_OK); + sfree(stuff); cleanup_exit(1); }