From 63ba06c763a1b9b62650898a8b44a59d85fc75f4 Mon Sep 17 00:00:00 2001 From: leitner Date: Mon, 8 Sep 2003 20:32:43 +0000 Subject: [PATCH] add iob test --- io/iob_send.c | 2 +- test/iob.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 test/iob.c diff --git a/io/iob_send.c b/io/iob_send.c index 0b89fd9..42f48d7 100644 --- a/io/iob_send.c +++ b/io/iob_send.c @@ -51,7 +51,7 @@ int64 iob_send(int64 s,io_batch* b) { } hdr.headers=v; hdr.hdr_cnt=headers; hdr.trailers=v+headers; hdr.trl_cnt=trailers; - r=sendfile(e[headers].fd,s,e[headers].offset,e[headers].bytes,&hdr,&sbytes,0); + r=sendfile(e[headers].fd,s,e[headers].offset,e[headers].n,&hdr,&sbytes,0); if (r==0) sent=b->bytesleft; else if (r==-1 && errno==EAGAIN) diff --git a/test/iob.c b/test/iob.c new file mode 100644 index 0000000..78ddee7 --- /dev/null +++ b/test/iob.c @@ -0,0 +1,13 @@ +#include +#include "iob.h" + +main() { + int64 fd; + io_batch* b; + assert(io_readfile(&fd,"GNUmakefile")); + assert(b=iob_new(10)); + assert(iob_addbuf(b,"Huhu",4)); + assert(iob_addbuf(b," fnord\n",7)); + assert(iob_addfile(b,fd,10,10)); + iob_send(1,b); +}