X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/23e649c97fc92d822cdaba2e9febc3099de77673..ecb2572233d5f3d3523a46979077ac0c20044d58:/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 */ }