From NetBSD 1.11:
authorJeroen Ruigrok/asmodai <asmodai@dragonflybsd.org>
Sun, 19 Sep 2004 18:08:21 +0000 (18:08 +0000)
committerJeroen Ruigrok/asmodai <asmodai@dragonflybsd.org>
Sun, 19 Sep 2004 18:08:21 +0000 (18:08 +0000)
Fix a condition where the hole would be inserted in the wrong place during a
split.

Inspired by FreeBSD commit, which did the same.

Submitted by: Simon 'corecode' Schubert.

lib/libc/db/btree/bt_split.c

index cb608b0..6610482 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  * @(#)bt_split.c      8.9 (Berkeley) 7/26/94
- * $DragonFly: src/lib/libc/db/btree/bt_split.c,v 1.4 2003/11/12 20:21:22 eirikn Exp $
+ * $DragonFly: src/lib/libc/db/btree/bt_split.c,v 1.5 2004/09/19 18:08:21 asmodai Exp $
  */
 
 #include <sys/types.h>
@@ -726,7 +726,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
         * the right page.
         */
        if (skip <= off) {
-               skip = 0;
+               skip = MAX_PAGE_OFFSET;
                rval = l;
        } else {
                rval = r;
@@ -736,7 +736,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
        for (off = 0; nxt < top; ++off) {
                if (skip == nxt) {
                        ++off;
-                       skip = 0;
+                       skip = MAX_PAGE_OFFSET;
                }
                switch (h->flags & P_TYPE) {
                case P_BINTERNAL: