shithub: riscv

Download patch

ref: 35f6a75355ea4f52f675f9cfbb865241512a7315
parent: 445d64a3879841f75d2dfcffcb720903e43ccaaf
author: cinap_lenrek <[email protected]>
date: Sat Apr 8 19:01:19 EDT 2017

upas/fs: make use of Maxmsg consistent

--- a/sys/src/cmd/upas/fs/cache.c
+++ b/sys/src/cmd/upas/fs/cache.c
@@ -75,7 +75,7 @@
 notecache(Mailbox *mb, Message *m, long sz)
 {
 	assert(Topmsg(mb, m));
-	assert(sz >= 0 && sz < Maxmsg);
+	assert(sz >= 0 && sz <= Maxmsg);
 	m->csize += sz;
 	mb->cached += sz;
 	addcache(mb, m);
@@ -310,7 +310,6 @@
 	l0 = m->end - m->start;
 	assert(l0 >= 0);
 	dprint("fetch %lud sz %lud o %llud l %lud badchars %d\n", l0, m->size, o, l, m->badchars);
-	assert(m->badchars < Maxmsg/10);
 	if(l0 == m->size || o > m->size)
 		return 0;
 	expand = 0;
--- a/sys/src/cmd/upas/fs/plan9.c
+++ b/sys/src/cmd/upas/fs/plan9.c
@@ -124,7 +124,7 @@
 		m->end--;
 	*m->end = 0;
 	m->size = m->end - m->start;
-	if(m->size >= Maxmsg)
+	if(m->size > Maxmsg)
 		return -1;
 	m->bend = m->rbend = m->end;
 	if(m->digest == 0)