diff options
author | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-05-01 18:17:40 +0000 |
---|---|---|
committer | Niall O'Higgins <niallo@cvs.openbsd.org> | 2006-05-01 18:17:40 +0000 |
commit | a47d9d3a9b6ba3fed577b04ac6562ee2c611e440 (patch) | |
tree | 6b49f72fa6ca0b7a12dd02bb19b2c0781cf7232e | |
parent | 624fe1c59ffda063948a39a809c06c801f8e3ce8 (diff) |
- fix a case in rcs_getrev() handling of branches where variant was not being
increased and thus no progress could be made in the loop.
bug noticed in rcsdiff(1) by sturm@
ok joris@
-rw-r--r-- | usr.bin/cvs/rcs.c | 9 | ||||
-rw-r--r-- | usr.bin/rcs/rcs.c | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 342dcbf50f8..036424a27a8 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -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 <jfb@openbsd.org> * All rights reserved. @@ -1163,7 +1163,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; @@ -1235,6 +1235,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; @@ -1257,9 +1259,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; } 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; } |