diff --git a/logging.c b/logging.c index f32e9cae..5302998f 100644 --- a/logging.c +++ b/logging.c @@ -34,6 +34,16 @@ void logtraffic(void *handle, unsigned char c, int logmode) } } +/* + * Flush any open log file. + */ +void logflush(void *handle) { + struct LogContext *ctx = (struct LogContext *)handle; + if (ctx->cfg.logtype > 0) + if (ctx->lgfp) + fflush(ctx->lgfp); +} + /* * Log an Event Log entry. Used in SSH packet logging mode; this is * also as convenient a place as any to put the output of Event Log diff --git a/putty.h b/putty.h index 6d4d83ae..3fb26bcc 100644 --- a/putty.h +++ b/putty.h @@ -655,6 +655,7 @@ void log_reconfig(void *logctx, Config *cfg); void logfopen(void *logctx); void logfclose(void *logctx); void logtraffic(void *logctx, unsigned char c, int logmode); +void logflush(void *logctx); void log_eventlog(void *logctx, const char *string); enum { PKT_INCOMING, PKT_OUTGOING }; void log_packet(void *logctx, int direction, int type, diff --git a/terminal.c b/terminal.c index bf531eee..00fd7c85 100644 --- a/terminal.c +++ b/terminal.c @@ -3311,6 +3311,7 @@ void term_out(Terminal *term) } term_print_flush(term); + logflush(term->logctx); } #if 0