]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Colin's and my fixes to connection_fatal().
authorSimon Tatham <anakin@pobox.com>
Sun, 4 May 2003 14:14:10 +0000 (14:14 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 4 May 2003 14:14:10 +0000 (14:14 +0000)
[originally from svn r3161]

raw.c
rlogin.c
ssh.c
telnet.c
window.c

diff --git a/raw.c b/raw.c
index 10e9ce64cf5ca320e83e4a7550d3d1bf84ca8b55..e7a159cd4daad5a2de527dde8d9ae375c0872bd4 100644 (file)
--- 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;
 }
index c12a0802e6f54f422b541a1e04432a9ffdb7ec87..aa8dc0dd2dfdfcf6c7dfd28e3db0784b6f07afe2 100644 (file)
--- 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 81ca0c87c32d4bfd9a20b1182931cf1043142a3d..11683c0e734388ab9c7dfae2451d39cc5ca0610e 100644 (file)
--- 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. */
     }
index e3fff49f9e3cf94cd3055a88fe227e3b43c1285a..d358f82fd782c8e3b1c168b7ede80aa16da1dc4b 100644 (file)
--- 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;
 }
index 32ed507fedd11af22398a8055fdee357e0baa90a..6d306f5677fd7fe5e105fcce15197b4e1fad4e63 100644 (file)
--- 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);
 }