mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
New Seat method, seat_nonfatal().
This is like the seat-independent nonfatal(), but specifies a Seat, which allows the GUI dialog box to have the right terminal window as its parent (if there are multiple ones). Changed over all the nonfatal() calls in the code base that could be localised to a Seat, which means all the ones that come up if something goes horribly wrong in host key storage. To make that possible, I've added a 'seat' parameter to store_host_key(); it turns out that all its call sites had one available already.
This commit is contained in:
@ -51,6 +51,7 @@ add_sources_from_current_dir(utils
|
||||
read_file_into.c
|
||||
seat_connection_fatal.c
|
||||
seat_dialog_text.c
|
||||
seat_nonfatal.c
|
||||
sessprep.c
|
||||
sk_free_peer_info.c
|
||||
smemclr.c
|
||||
|
19
utils/seat_nonfatal.c
Normal file
19
utils/seat_nonfatal.c
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Wrapper function for the nonfatal() method of a Seat,
|
||||
* providing printf-style formatting.
|
||||
*/
|
||||
|
||||
#include "putty.h"
|
||||
|
||||
void seat_nonfatal(Seat *seat, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *msg;
|
||||
|
||||
va_start(ap, fmt);
|
||||
msg = dupvprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
seat->vt->nonfatal(seat, msg);
|
||||
sfree(msg);
|
||||
}
|
@ -288,6 +288,17 @@ static void tempseat_connection_fatal(Seat *seat, const char *message)
|
||||
unreachable("connection_fatal should never be called on TempSeat");
|
||||
}
|
||||
|
||||
static void tempseat_nonfatal(Seat *seat, const char *message)
|
||||
{
|
||||
/*
|
||||
* Non-fatal errors specific to a Seat should also not occur,
|
||||
* because those will be for things like I/O errors writing the
|
||||
* host key collection, and a backend's not _doing_ that when we
|
||||
* haven't connected it to the host yet.
|
||||
*/
|
||||
unreachable("nonfatal should never be called on TempSeat");
|
||||
}
|
||||
|
||||
static bool tempseat_eof(Seat *seat)
|
||||
{
|
||||
/*
|
||||
@ -327,6 +338,7 @@ static const struct SeatVtable tempseat_vt = {
|
||||
.notify_remote_exit = tempseat_notify_remote_exit,
|
||||
.notify_remote_disconnect = tempseat_notify_remote_disconnect,
|
||||
.connection_fatal = tempseat_connection_fatal,
|
||||
.nonfatal = tempseat_nonfatal,
|
||||
.update_specials_menu = tempseat_update_specials_menu,
|
||||
.get_ttymode = tempseat_get_ttymode,
|
||||
.set_busy_status = tempseat_set_busy_status,
|
||||
|
Reference in New Issue
Block a user