changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > plan9front / sys/src/cmd/upas/fs/cache.c

revision 7405: 82225c0fc1a2
parent 6985: 8c50688cb280
child 7464: 6d87e952f4e5
     1.1--- a/sys/src/cmd/upas/fs/cache.c
     1.2+++ b/sys/src/cmd/upas/fs/cache.c
     1.3@@ -319,14 +319,17 @@ found:
     1.4 void
     1.5 digestmessage(Mailbox *mb, Message *m)
     1.6 {
     1.7+	Message *old;
     1.8+
     1.9 	assert(m->digest == nil);
    1.10 	m->digest = emalloc(SHA1dlen);
    1.11 	sha1((uchar*)m->start, m->end - m->start, m->digest, nil);
    1.12-	if(mtreeisdup(mb, m)){
    1.13+	old = mtreeadd(mb, m);
    1.14+	if(old != nil && old != m){
    1.15+		m = mtreeadd(mb, old);
    1.16 		logmsg(m, "dup detected");
    1.17 		m->deleted = Dup;	/* no dups allowed */
    1.18-	}else
    1.19-		mtreeadd(mb, m);
    1.20+	}
    1.21 	dprint("%lud %#A\n", m->id, m->digest);
    1.22 }
    1.23