mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Fix error with failure to write with stdout due to different semantics with fwrite vs write.
This commit is contained in:
parent
597be1ffbd
commit
8af8ad17e4
6
lrzip.c
6
lrzip.c
|
|
@ -326,12 +326,14 @@ static bool fwrite_stdout(rzip_control *control, void *buf, i64 len)
|
||||||
|
|
||||||
total = 0;
|
total = 0;
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
|
ssize_t wrote;
|
||||||
|
|
||||||
if (len > one_g)
|
if (len > one_g)
|
||||||
ret = one_g;
|
ret = one_g;
|
||||||
else
|
else
|
||||||
ret = len;
|
ret = len;
|
||||||
ret = fwrite(offset_buf, 1, ret, control->outFILE);
|
wrote = fwrite(offset_buf, 1, ret, control->outFILE);
|
||||||
if (unlikely(ret <= 0))
|
if (unlikely(wrote != ret))
|
||||||
fatal_return(("Failed to fwrite in fwrite_stdout\n"), false);
|
fatal_return(("Failed to fwrite in fwrite_stdout\n"), false);
|
||||||
len -= ret;
|
len -= ret;
|
||||||
offset_buf += ret;
|
offset_buf += ret;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue