=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.170 retrieving revision 1.171 diff -u -r1.170 -r1.171 --- src/usr.bin/cvs/rcs.c 2006/04/25 10:31:39 1.170 +++ src/usr.bin/cvs/rcs.c 2006/05/01 18:17:39 1.171 @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.170 2006/04/25 10:31:39 xsa Exp $ */ +/* $OpenBSD: rcs.c,v 1.171 2006/05/01 18:17:39 niallo Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -1163,7 +1163,7 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev) { u_int i, numlen; - int isbranch, lookonbranch; + int isbranch, lookonbranch, found; size_t len; void *bp; RCSNUM *crev, *rev, *brev; @@ -1235,6 +1235,8 @@ /* Apply patches backwards to get the right version. */ do { + found = 0; + if (rcsnum_cmp(rfp->rf_head, rev, 0) == 0) break; @@ -1257,9 +1259,12 @@ if (i == numlen) { crev = rb->rb_num; + found = 1; break; } } + if (found == 0) + crev = rdp->rd_next; } else { crev = rdp->rd_next; }