From: Markus Armbruster Date: Thu, 31 Dec 2009 11:12:39 +0000 (+0100) Subject: Fix new_seqno()'s recovery from seqno mismatch X-Git-Tag: v4.3.24~45 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=18148f03fa96cad1dbca2e9a087670153a6b19dd Fix new_seqno()'s recovery from seqno mismatch A sequence number mismatch occurs when an invalid copy (with a stale sequence number) gets written. To continue after the error, we need to use the current sequence number. But new_seqno() used the larger one of the two, which is correct only as long as sequence numbers do not overflow. Overflow is rather unlikely, though. --- diff --git a/src/lib/common/file.c b/src/lib/common/file.c index af02cf184..f32bafa4b 100644 --- a/src/lib/common/file.c +++ b/src/lib/common/file.c @@ -603,8 +603,7 @@ new_seqno(struct empfile *ep, void *buf) if (!(ep->flags & EFF_TYPED)) return; old_seqno = get_seqno(ep, elt->uid); - if (CANT_HAPPEN(old_seqno != elt->seqno)) - old_seqno = MAX(old_seqno, elt->seqno); + CANT_HAPPEN(old_seqno != elt->seqno); elt->seqno = old_seqno + 1; }