diff --git a/lrzip.c b/lrzip.c index e455ce0..f692a67 100644 --- a/lrzip.c +++ b/lrzip.c @@ -326,12 +326,14 @@ static bool fwrite_stdout(rzip_control *control, void *buf, i64 len) total = 0; while (len > 0) { + ssize_t wrote; + if (len > one_g) ret = one_g; else ret = len; - ret = fwrite(offset_buf, 1, ret, control->outFILE); - if (unlikely(ret <= 0)) + wrote = fwrite(offset_buf, 1, ret, control->outFILE); + if (unlikely(wrote != ret)) fatal_return(("Failed to fwrite in fwrite_stdout\n"), false); len -= ret; offset_buf += ret;