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