[CONSRV]
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 11 Dec 2012 01:45:49 +0000 (01:45 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Tue, 11 Dec 2012 01:45:49 +0000 (01:45 +0000)
However here, we must keep the incrementation at the end of the loop, because of a possible corner case (a loop-break which takes place when we reach the last element of the list, but NextEntry already points to its head because of the cyclicity of the list) with the following 'if'-test made just after the loop.

svn path=/branches/ros-csrss/; revision=57867

subsystems/win32/csrsrv/procsup.c
subsystems/win32/csrsrv/thredsup.c

index c79fdee..97dd0cb 100644 (file)
@@ -1118,7 +1118,7 @@ CsrLockProcessByClientId(IN HANDLE Pid,
         CsrLockedReferenceProcess(CurrentProcess);
         *CsrProcess = CurrentProcess;
     }
-    
+
     /* Return the result */
     return Status;
 }
index 77c02cf..61a572e 100644 (file)
@@ -970,9 +970,6 @@ CsrLockThreadByClientId(IN HANDLE Tid,
         /* Get the Process */
         CurrentThread = CONTAINING_RECORD(NextEntry, CSR_THREAD, HashLinks);
 
-        /* Move to the next entry */
-        NextEntry = NextEntry->Flink;
-
         /* Check for PID Match */
         if ((CurrentThread->ClientId.UniqueThread == Tid) &&
             !(CurrentThread->Flags & CsrThreadTerminated))
@@ -980,6 +977,9 @@ CsrLockThreadByClientId(IN HANDLE Tid,
             /* Get out of here */
             break;
         }
+
+        /* Move to the next entry */
+        NextEntry = NextEntry->Flink;
     }
 
     /* Nothing found if we got back to the list */