When looking for revision, break out of the loop at the end rather than
authornicm <nicm@openbsd.org>
Sat, 31 Jul 2010 11:37:37 +0000 (11:37 +0000)
committernicm <nicm@openbsd.org>
Sat, 31 Jul 2010 11:37:37 +0000 (11:37 +0000)
looping forever.

This prevents the server going into an infinite loop when the repository
is behind the checkout, but the behaviour is not correct (it is an error
rather than ignoring the file), so mark with an XXX for now. Some
underlying OpenCVS functions are too fatal()-happy and will probably
need to be changed in order to fix this properly.

Problem reported by sthen.

ok xsa ray

usr.bin/cvs/rcs.c

index 3eac5b2..4ea2d59 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rcs.c,v 1.297 2010/07/23 21:46:05 ray Exp $   */
+/*     $OpenBSD: rcs.c,v 1.298 2010/07/31 11:37:37 nicm Exp $  */
 /*
  * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
  * All rights reserved.
@@ -2783,6 +2783,13 @@ again:
                        trdp = rcs_findrev(rfp, rdp->rd_next);
                        if (trdp == NULL)
                                fatal("failed to grab next revision");
+               } else {
+                       /*
+                        * XXX Fail, although the caller does not always do the
+                        * right thing (eg cvs diff when the tree is ahead of
+                        * the repository).
+                        */
+                       break;
                }
 
                if (rdp->rd_tlen == 0) {