mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-04-07 07:14:06 +00:00
Cast the mallocs to their variable type.
Check that read and write actually return greater than zero.
This commit is contained in:
parent
3879807865
commit
f2d33c00f8
2 changed files with 4 additions and 4 deletions
4
stream.c
4
stream.c
|
|
@ -606,7 +606,7 @@ ssize_t write_1g(int fd, void *buf, i64 len)
|
|||
else
|
||||
ret = len;
|
||||
ret = write(fd, offset_buf, (size_t)ret);
|
||||
if (unlikely(ret < 0))
|
||||
if (unlikely(ret <= 0))
|
||||
return ret;
|
||||
len -= ret;
|
||||
offset_buf += ret;
|
||||
|
|
@ -629,7 +629,7 @@ ssize_t read_1g(int fd, void *buf, i64 len)
|
|||
else
|
||||
ret = len;
|
||||
ret = read(fd, offset_buf, (size_t)ret);
|
||||
if (unlikely(ret < 0))
|
||||
if (unlikely(ret <= 0))
|
||||
return ret;
|
||||
len -= ret;
|
||||
offset_buf += ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue