shithub: riscv

Download patch

ref: a863cf8e7e63b40f4cd52909b7b625912d41309c
parent: 5054c9795cb02c9b4e05608bbf345790619ed3fa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Jan 24 21:14:51 EST 2018

upas/fs: deal with imap returning more uid's than allocated from previus "messages" command

--- a/sys/src/cmd/upas/fs/imap.c
+++ b/sys/src/cmd/upas/fs/imap.c
@@ -916,7 +916,11 @@
 
 	f = imap->f;
 	n = imap->nuid;
-	if(n < imap->nmsg) idprint(imap, "partial sync %d < %d\n", n, imap->nmsg);
+	if(n > imap->muid){
+		idprint(imap, "partial sync %d > %d\n", n, imap->muid);
+		n = imap->nuid = imap->muid;
+	} else if(n < imap->nmsg)
+		idprint(imap, "partial sync %d < %d\n", n, imap->nmsg);
 	qsort(f, n, sizeof f[0], (int(*)(void*, void*))fetchicmp);
 	ll = &mb->root->part;
 	for(i = 0; (m = *ll) != nil || i < n; ){