1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-02-03 21:52: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)); conf_get_bool(inst->conf, CONF_tcp_keepalives));
if (error) { if (error) {
seat_connection_fatal(&inst->seat, if (cmdline_tooltype & TOOLTYPE_NONNETWORK) {
"Unable to open connection to %s:\n%s", /* Special case for pterm. */
conf_dest(inst->conf), error); 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); sfree(error);
inst->exited = true; inst->exited = true;
return; return;

View File

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