summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/rcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/rcs/rcs.c')
-rw-r--r--usr.bin/rcs/rcs.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/rcs/rcs.c b/usr.bin/rcs/rcs.c
index 2eca0e99d7f..5721b2b211c 100644
--- a/usr.bin/rcs/rcs.c
+++ b/usr.bin/rcs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.5 2006/04/29 05:31:28 ray Exp $ */
+/* $OpenBSD: rcs.c,v 1.6 2006/05/01 18:17:39 niallo Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -1121,7 +1121,7 @@ BUF*
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;
@@ -1193,6 +1193,8 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
/* Apply patches backwards to get the right version.
*/
do {
+ found = 0;
+
if (rcsnum_cmp(rfp->rf_head, rev, 0) == 0)
break;
@@ -1215,9 +1217,12 @@ rcs_getrev(RCSFILE *rfp, RCSNUM *frev)
if (i == numlen) {
crev = rb->rb_num;
+ found = 1;
break;
}
}
+ if (found == 0)
+ crev = rdp->rd_next;
} else {
crev = rdp->rd_next;
}