Colin's and my fixes to connection_fatal().

[originally from svn r3161]
This commit is contained in:
Simon Tatham 2003-05-04 14:14:10 +00:00
Родитель 135abf2445
Коммит 0bfe876b57
5 изменённых файлов: 17 добавлений и 12 удалений

2
raw.c
Просмотреть файл

@ -41,7 +41,7 @@ static int raw_closing(Plug plug, char *error_msg, int error_code,
if (error_msg) { if (error_msg) {
/* A socket error has occurred. */ /* A socket error has occurred. */
logevent(raw->frontend, error_msg); 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. */ } /* Otherwise, the remote side closed the connection normally. */
return 0; return 0;
} }

Просмотреть файл

@ -43,7 +43,7 @@ static int rlogin_closing(Plug plug, char *error_msg, int error_code,
if (error_msg) { if (error_msg) {
/* A socket error has occurred. */ /* A socket error has occurred. */
logevent(rlogin->frontend, error_msg); 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. */ } /* Otherwise, the remote side closed the connection normally. */
return 0; return 0;
} }

2
ssh.c
Просмотреть файл

@ -2085,7 +2085,7 @@ static int ssh_closing(Plug plug, char *error_msg, int error_code,
if (error_msg) { if (error_msg) {
/* A socket error has occurred. */ /* A socket error has occurred. */
logevent(error_msg); logevent(error_msg);
connection_fatal(ssh->frontend, error_msg); connection_fatal(ssh->frontend, "%s", error_msg);
} else { } else {
/* Otherwise, the remote side closed the connection normally. */ /* Otherwise, the remote side closed the connection normally. */
} }

Просмотреть файл

@ -643,7 +643,7 @@ static int telnet_closing(Plug plug, char *error_msg, int error_code,
if (error_msg) { if (error_msg) {
/* A socket error has occurred. */ /* A socket error has occurred. */
logevent(telnet->frontend, error_msg); 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. */ } /* Otherwise, the remote side closed the connection normally. */
return 0; return 0;
} }

Просмотреть файл

@ -930,13 +930,15 @@ void set_raw_mouse_mode(void *frontend, int activate)
void connection_fatal(void *frontend, char *fmt, ...) void connection_fatal(void *frontend, char *fmt, ...)
{ {
va_list ap; va_list ap;
char stuff[200], morestuff[100]; char *stuff, morestuff[100];
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(stuff, fmt, ap); stuff = dupvprintf(fmt, ap);
va_end(ap); va_end(ap);
sprintf(morestuff, "%.70s Fatal Error", appname); sprintf(morestuff, "%.70s Fatal Error", appname);
MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
sfree(stuff);
if (cfg.close_on_exit == FORCE_ON) if (cfg.close_on_exit == FORCE_ON)
PostQuitMessage(1); PostQuitMessage(1);
else { else {
@ -953,13 +955,14 @@ void connection_fatal(void *frontend, char *fmt, ...)
void cmdline_error(char *fmt, ...) void cmdline_error(char *fmt, ...)
{ {
va_list ap; va_list ap;
char stuff[200], morestuff[100]; char *stuff, morestuff[100];
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(stuff, fmt, ap); stuff = dupvprintf(fmt, ap);
va_end(ap); va_end(ap);
sprintf(morestuff, "%.70s Command Line Error", appname); sprintf(morestuff, "%.70s Command Line Error", appname);
MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
sfree(stuff);
exit(1); exit(1);
} }
@ -4302,13 +4305,14 @@ void optimised_move(void *frontend, int to, int from, int lines)
void fatalbox(char *fmt, ...) void fatalbox(char *fmt, ...)
{ {
va_list ap; va_list ap;
char stuff[200], morestuff[100]; char *stuff, morestuff[100];
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(stuff, fmt, ap); stuff = dupvprintf(fmt, ap);
va_end(ap); va_end(ap);
sprintf(morestuff, "%.70s Fatal Error", appname); sprintf(morestuff, "%.70s Fatal Error", appname);
MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK); MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
sfree(stuff);
cleanup_exit(1); cleanup_exit(1);
} }
@ -4318,14 +4322,15 @@ void fatalbox(char *fmt, ...)
void modalfatalbox(char *fmt, ...) void modalfatalbox(char *fmt, ...)
{ {
va_list ap; va_list ap;
char stuff[200], morestuff[100]; char *stuff, morestuff[100];
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(stuff, fmt, ap); stuff = dupvprintf(fmt, ap);
va_end(ap); va_end(ap);
sprintf(morestuff, "%.70s Fatal Error", appname); sprintf(morestuff, "%.70s Fatal Error", appname);
MessageBox(hwnd, stuff, morestuff, MessageBox(hwnd, stuff, morestuff,
MB_SYSTEMMODAL | MB_ICONERROR | MB_OK); MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
sfree(stuff);
cleanup_exit(1); cleanup_exit(1);
} }