Colin's and my fixes to connection_fatal().
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 4 May 2003 14:14:10 +0000 (14:14 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 4 May 2003 14:14:10 +0000 (14:14 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@3161 cda61777-01e9-0310-a592-d414129be87e

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

diff --git a/raw.c b/raw.c
index 10e9ce6..e7a159c 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 c12a080..aa8dc0d 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 81ca0c8..11683c0 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 e3fff49..d358f82 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 32ed507..6d306f5 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);
 }