diff --git a/io/io_sendfile.c b/io/io_sendfile.c index 077ad15..92285fe 100644 --- a/io/io_sendfile.c +++ b/io/io_sendfile.c @@ -60,13 +60,12 @@ int64 io_sendfile(int64 out,int64 in,uint64 off,uint64 bytes) { if (off>=e->mapofs && offmapofs+e->maplen) goto mapok; /* ok; mmapped the right chunk*/ munmap(e->mmapped,e->maplen); - e->mmapped=0; } e->mapofs=off&0xffffffffffff0000ull; - if (e->mapofs+0xffff>off+bytes) + if (e->mapofs+0x10000>off+bytes) e->maplen=off+bytes-e->mapofs; else - e->maplen=0xffff; + e->maplen=0x10000; if ((e->mmapped=mmap(0,e->maplen,PROT_READ,MAP_SHARED,in,e->mapofs))==MAP_FAILED) { e->mmapped=0; goto readwrite; diff --git a/t.c b/t.c index c0fdd1d..8e3db16 100644 --- a/t.c +++ b/t.c @@ -23,12 +23,19 @@ __asm__ __volatile__ ("rdtsc" : "=a" (low) : : "edx") int main(int argc,char* argv[]) { + char buf[100]; + int i; + printf("%d\n",i=fmt_pad(buf,"fnord",5,7,10)); + buf[i]=0; + puts(buf); +#if 0 char ip[16]; char buf[32]; printf("%d (expect 2)\n",scan_ip6("::",ip)); printf("%d (expect 3)\n",scan_ip6("::1",ip)); printf("%d (expect 16)\n",scan_ip6("fec0:0:0:ffff::1/0",ip)); printf("%.*s\n",fmt_ip6(buf,ip),buf); +#endif #if 0 static stralloc s,t; stralloc_copys(&s,"fnord");