summaryrefslogtreecommitdiffstats
path: root/stream/stream_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/stream_file.c')
-rw-r--r--stream/stream_file.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 22be803fba..6d436cf6f5 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -56,8 +56,16 @@ static int fill_buffer(stream_t *s, char* buffer, int max_len){
}
static int write_buffer(stream_t *s, char* buffer, int len) {
- int r = write(s->fd,buffer,len);
- return (r <= 0) ? -1 : r;
+ int r;
+ int wr = 0;
+ while (wr < len) {
+ r = write(s->fd,buffer,len);
+ if (r <= 0)
+ return -1;
+ wr += r;
+ buffer += r;
+ }
+ return len;
}
static int seek(stream_t *s,off_t newpos) {