1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Special backend init error handling for pterm.

Fixes a cosmetic issue where the new ConPTY error added in 4ae8b742ab
had an ugly "Unable to open connection to".

(Arguably this ought to test a backend property rather than
cmdline_tooltype.)
This commit is contained in:
Jacob Nevins 2022-05-24 13:32:55 +01:00
parent 56458a1491
commit c5d837c14a
2 changed files with 20 additions and 7 deletions

View File

@ -5165,9 +5165,16 @@ static void start_backend(GtkFrontend *inst)
conf_get_bool(inst->conf, CONF_tcp_keepalives));
if (error) {
seat_connection_fatal(&inst->seat,
"Unable to open connection to %s:\n%s",
conf_dest(inst->conf), error);
if (cmdline_tooltype & TOOLTYPE_NONNETWORK) {
/* Special case for pterm. */
seat_connection_fatal(&inst->seat,
"Unable to open terminal:\n%s",
error);
} else {
seat_connection_fatal(&inst->seat,
"Unable to open connection to %s:\n%s",
conf_dest(inst->conf), error);
}
sfree(error);
inst->exited = true;
return;

View File

@ -1,6 +1,6 @@
/*
* window.c - the PuTTY(tel) main program, which runs a PuTTY terminal
* emulator and backend in a window.
* window.c - the PuTTY(tel)/pterm main program, which runs a PuTTY
* terminal emulator and backend in a window.
*/
#include <stdio.h>
@ -381,8 +381,14 @@ static void start_backend(void)
conf_get_bool(conf, CONF_tcp_keepalives));
if (error) {
char *str = dupprintf("%s Error", appname);
char *msg = dupprintf("Unable to open connection to\n%s\n%s",
conf_dest(conf), error);
char *msg;
if (cmdline_tooltype & TOOLTYPE_NONNETWORK) {
/* Special case for pterm. */
msg = dupprintf("Unable to open terminal:\n%s", error);
} else {
msg = dupprintf("Unable to open connection to\n%s\n%s",
conf_dest(conf), error);
}
sfree(error);
MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
sfree(str);