]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - logging.c
Workarounds for compiling with -D_FORTIFY_SOURCE=2 (as Ubuntu does), which
[PuTTY.git] / logging.c
index f1e3729585d29aa1663855cfcaf3d29572cbb36d..49269ec3c949efcd5a63044304a03f6ac83b4a1c 100644 (file)
--- 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 */
 }