1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

windows/window.c: make random_save_seed call unconditional.

The conditionalisation of that call on 'protocol == PROT_SSH' has been
around since the beginning of our git history. But in those days,
random_save_seed() was unconditional _internally_ - it would always
create and write to the seed file regardless of whether the random
pool had even been initialised, let alone used.

Now random_save_seed() has its own internal condition which prevents
it doing anything if the random subsystem was never started up in the
first place. So it's better to call it unconditionally from
cleanup_exit, and then it'll be able to do its thing whenever needed,
without having to second-guess based on the top-level protocol.

(In fact, that's what all the other implementations of cleanup_exit()
have done all along. On Unix, and in Windows console apps, we do call
random_save_seed() unconditionally, and expect it to uncomplainingly
do nothing if there's nothing to do.)
This commit is contained in:
Simon Tatham 2022-09-12 12:55:47 +01:00
parent 1a3655013d
commit 260aad5fca

View File

@ -1018,9 +1018,7 @@ void cleanup_exit(int code)
DeleteObject(pal);
sk_cleanup();
if (conf_get_int(conf, CONF_protocol) == PROT_SSH) {
random_save_seed();
}
random_save_seed();
shutdown_help();
/* Clean up COM. */