X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/b078de41dfbae96dfb831e6e06df047b669adc4c..13874a7c4dd056a4db43fb60075075fc73d8abc4:/logging.c diff --git a/logging.c b/logging.c index f1e37295..49269ec3 100644 --- a/logging.c +++ b/logging.c @@ -43,7 +43,10 @@ static void logwrite(struct LogContext *ctx, void *data, int len) bufchain_add(&ctx->queue, data, len); } else if (ctx->state == L_OPEN) { assert(ctx->lgfp); - fwrite(data, 1, len, ctx->lgfp); + if (fwrite(data, 1, len, ctx->lgfp) < len) { + logfclose(ctx); + ctx->state = L_ERROR; + } } /* else L_ERROR, so ignore the write */ }