From bf61b5660299e88399304cd8eb9bacddc73a765b Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 12 Jan 2003 13:44:35 +0000 Subject: [PATCH 1/1] Each platform's implementation of askappend() is no longer required to consult cfg.logxfovr, because it gets done once in logging.c. askappend() is now called only when a question _really_ needs to be asked of the user. Also in this checkin, cleanup_exit() in console.c no longer consults cfg.protocol to decide whether to save the random seed, because random_save_seed() can make that decision for itself and do it better. git-svn-id: svn://svn.tartarus.org/sgt/putty@2552 cda61777-01e9-0310-a592-d414129be87e --- console.c | 9 ++------- logging.c | 5 ++++- unix/uxcons.c | 3 --- windlg.c | 4 +--- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/console.c b/console.c index 703e6837..c9284b19 100644 --- a/console.c +++ b/console.c @@ -26,12 +26,10 @@ void cleanup_exit(int code) sk_cleanup(); WSACleanup(); - if (cfg.protocol == PROT_SSH) { - random_save_seed(); + random_save_seed(); #ifdef MSCRYPTOAPI - crypto_wrapup(); + crypto_wrapup(); #endif - } exit(code); } @@ -212,9 +210,6 @@ int askappend(void *frontend, char *filename) char line[32]; - if (cfg.logxfovr != LGXF_ASK) { - return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1); - } if (console_batch_mode) { fprintf(stderr, msgtemplate_batch, FILENAME_MAX, filename); fflush(stderr); diff --git a/logging.c b/logging.c index 9e8b9f83..c2c4ff15 100644 --- a/logging.c +++ b/logging.c @@ -118,7 +118,10 @@ void logfopen(void *handle) if (ctx->lgfp) { int i; fclose(ctx->lgfp); - i = askappend(ctx->frontend, ctx->currlogfilename); + if (cfg.logxfovr != LGXF_ASK) { + i = ((cfg.logxfovr == LGXF_OVR) ? 2 : 1); + } else + i = askappend(ctx->frontend, ctx->currlogfilename); if (i == 1) writemod[0] = 'a'; /* set append mode */ else if (i == 0) { /* cancelled */ diff --git a/unix/uxcons.c b/unix/uxcons.c index 779ebf43..579178c7 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -204,9 +204,6 @@ int askappend(void *frontend, char *filename) char line[32]; - if (cfg.logxfovr != LGXF_ASK) { - return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1); - } if (console_batch_mode) { fprintf(stderr, msgtemplate_batch, FILENAME_MAX, filename); fflush(stderr); diff --git a/windlg.c b/windlg.c index a8603e65..cb19e76d 100644 --- a/windlg.c +++ b/windlg.c @@ -3951,9 +3951,7 @@ int askappend(void *frontend, char *filename) "or Cancel to disable logging."; char message[sizeof(msgtemplate) + FILENAME_MAX]; int mbret; - if (cfg.logxfovr != LGXF_ASK) { - return ((cfg.logxfovr == LGXF_OVR) ? 2 : 1); - } + sprintf(message, msgtemplate, FILENAME_MAX, filename); mbret = MessageBox(NULL, message, mbtitle, -- 2.11.0