projects
/
zchunk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ff34ee9
)
Properly detect a read error.
author
Peter Pentchev
<roam@ringlet.net>
Sun, 22 Aug 2021 11:51:11 +0000
(14:51 +0300)
committer
Peter Pentchev
<roam@ringlet.net>
Sun, 22 Aug 2021 11:51:11 +0000
(14:51 +0300)
Spotted by: cppcheck
src/lib/io.c
patch
|
blob
|
history
diff --git
a/src/lib/io.c
b/src/lib/io.c
index 5925d513743ab06be944b6a627b1f0387e95bb78..b91b7ca4f3cc64deacd0c3136186deb77557eaf7 100644
(file)
--- a/
src/lib/io.c
+++ b/
src/lib/io.c
@@
-115,11
+115,13
@@
int chunks_from_temp(zckCtx *zck) {
char *data = zmalloc(BUF_SIZE);
while((read_count = read(zck->temp_fd, data, BUF_SIZE)) > 0) {
- if(
read_count == -1 ||
!write_data(zck, zck->fd, data, read_count)) {
+ if(!write_data(zck, zck->fd, data, read_count)) {
free(data);
return false;
}
}
free(data);
+ if(read_count == -1)
+ return false;
return true;
}