Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: Fixed another bufio bug.
[ashd.git]
/
lib
/
bufio.c
diff --git
a/lib/bufio.c
b/lib/bufio.c
index
4f2ad10
..
fe5d005
100644
(file)
--- a/
lib/bufio.c
+++ b/
lib/bufio.c
@@
-228,6
+228,7
@@
ssize_t biowrite(struct bufio *bio, const void *data, size_t len)
}
if(len < bio->wbuf.s - bio->wbuf.d) {
memcpy(bio->wbuf.b + bio->wbuf.d, data, len);
}
if(len < bio->wbuf.s - bio->wbuf.d) {
memcpy(bio->wbuf.b + bio->wbuf.d, data, len);
+ bio->wbuf.d += len;
wb += len;
len = 0;
} else {
wb += len;
len = 0;
} else {
@@
-247,7
+248,7
@@
ssize_t biowrite(struct bufio *bio, const void *data, size_t len)
data += ret; len -= ret; wb += ret;
}
}
data += ret; len -= ret; wb += ret;
}
}
- return(
0
);
+ return(
wb
);
}
ssize_t biowritesome(struct bufio *bio, const void *data, size_t len)
}
ssize_t biowritesome(struct bufio *bio, const void *data, size_t len)
@@
-258,8
+259,10
@@
ssize_t biowritesome(struct bufio *bio, const void *data, size_t len)
if(bio->wh == bio->wbuf.d)
bio->wh = bio->wbuf.d = 0;
if(bio->wbuf.d == bio->wbuf.s) {
if(bio->wh == bio->wbuf.d)
bio->wh = bio->wbuf.d = 0;
if(bio->wbuf.d == bio->wbuf.s) {
- if(bio->wh > 0)
+ if(bio->wh > 0)
{
memmove(bio->wbuf.b, bio->wbuf.b + bio->wh, bio->wbuf.d -= bio->wh);
memmove(bio->wbuf.b, bio->wbuf.b + bio->wh, bio->wbuf.d -= bio->wh);
+ bio->wh = 0;
+ }
}
ret = min(len, bio->wbuf.s - bio->wbuf.d);
memcpy(bio->wbuf.b + bio->wbuf.d, data, ret);
}
ret = min(len, bio->wbuf.s - bio->wbuf.d);
memcpy(bio->wbuf.b + bio->wbuf.d, data, ret);