Windows: AFSRemoveCaseInsensitiveDirEntry corrections
authorPeter Scott <pscott@kerneldrivers.com>
Tue, 18 Oct 2011 14:04:48 +0000 (10:04 -0400)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 25 Oct 2011 04:38:35 +0000 (21:38 -0700)
If there is a fLink but no parentLink for the DirEntry being
removed, return the fLink as the new value for *RootNode.

This patch set also includes two changes that improve readability
but do not alter the behavior.

Change-Id: I112265798df9d46c83ffacddc7d97ad0f6fce5bf
Reviewed-on: http://gerrit.openafs.org/5638
Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com>
Reviewed-by: Peter Scott <pscott.kd@gmail.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsrdr/kernel/lib/AFSBTreeSupport.cpp

index 107e53b..a870045 100644 (file)
@@ -690,7 +690,8 @@ AFSRemoveCaseInsensitiveDirEntry( IN AFSDirectoryCB **RootNode,
 
             try_return( ntStatus);
         }
-        else if( DirEntry->CaseInsensitiveList.fLink != NULL)
+
+        if( DirEntry->CaseInsensitiveList.fLink != NULL)
         {
 
             //
@@ -711,6 +712,10 @@ AFSRemoveCaseInsensitiveDirEntry( IN AFSDirectoryCB **RootNode,
                     pParentNode->CaseInsensitiveTreeEntry.leftLink = (void *)pNewHeadEntry;
                 }
             }
+            else
+            {
+                *RootNode = pNewHeadEntry;
+            }
 
             if( pRightNode != NULL)
             {
@@ -732,7 +737,7 @@ AFSRemoveCaseInsensitiveDirEntry( IN AFSDirectoryCB **RootNode,
 
             pNewHeadEntry->CaseInsensitiveTreeEntry.rightLink = pRightNode;
 
-            SetFlag( ((AFSDirectoryCB *)DirEntry->CaseInsensitiveList.fLink)->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD);
+            SetFlag( pNewHeadEntry->Flags, AFS_DIR_ENTRY_CASE_INSENSTIVE_LIST_HEAD);
 
             try_return( ntStatus);
         }