From 260aad5fcac562702a799d945d48ad8b0e26d29c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 12 Sep 2022 12:55:47 +0100 Subject: [PATCH] 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.) --- windows/window.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/windows/window.c b/windows/window.c index 059a123c..4a920492 100644 --- a/windows/window.c +++ b/windows/window.c @@ -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. */