Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fc253e2
)
lib: Report as many errors as possible from biowritesome.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 14 May 2016 01:13:25 +0000
(
03:13
+0200)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Sat, 14 May 2016 01:13:25 +0000
(
03:13
+0200)
lib/bufio.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/bufio.c
b/lib/bufio.c
index
fe5d005
..
1929d31
100644
(file)
--- a/
lib/bufio.c
+++ b/
lib/bufio.c
@@
-267,8
+267,14
@@
ssize_t biowritesome(struct bufio *bio, const void *data, size_t len)
ret = min(len, bio->wbuf.s - bio->wbuf.d);
memcpy(bio->wbuf.b + bio->wbuf.d, data, ret);
bio->wbuf.d += ret;
- if((bioflushsome(bio) < 0) && (ret == 0))
- return(-1);
+ if(bioflushsome(bio) < 0) {
+ if(ret == 0)
+ return(-1);
+ if(ret < bio->wbuf.d - bio->wh) { /* Should never be false */
+ bio->wbuf.d -= ret;
+ return(-1);
+ }
+ }
return(ret);
}