]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DEVEL15-windows-btree-rename-case-only-20071004
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 4 Oct 2007 15:13:10 +0000 (15:13 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 4 Oct 2007 15:13:10 +0000 (15:13 +0000)
Attempts to rename by case only would fail when there are more than
one ambiguous matches.  The list of data nodes would be corrupted
and future tree manipulations could result in a crash.

(cherry picked from commit 3c216378cba651dcb6519d7e615be37b534b56c8)

src/WINNT/afsd/cm_btree.c

index 26128eb98770281df434cc0a10b1c8d51da759c5..884f9fdb72c996956d9538924f028d60275234cc 100644 (file)
@@ -733,14 +733,17 @@ descendBalance(Tree *B, Nptr curr, Nptr left, Nptr right, Nptr lAnc, Nptr rAnc,
              * options.  So we must determine if any of the next nodes
              * are the one we are looking for.
              */
-            Nptr dataNode = newNode;
+            Nptr prev = newNode;
 
             while ( next ) {
                 if (!comparekeys(B)(getfunkey(B), getdatakey(next), EXACT_MATCH)) {
                     /* we found the one to delete */
-                    getdatanext(dataNode) = getdatanext(next);
+                    getdatanext(prev) = getdatanext(next);
                     putFreeNode(B, next);
+                    break;
                 }
+                prev = next;
+                next = getdatanext(next);
             }
             
             /* do not delete the key */