Sebastian Lackner : ntdll: Assert when trying to replace an exiting file descriptor in fd_cache.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Mar 4 09:22:16 CST 2015


Module: wine
Branch: master
Commit: bf65fef8bcd51459090724f65148571fa1da09c5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bf65fef8bcd51459090724f65148571fa1da09c5

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Sun Mar  1 02:36:45 2015 +0100

ntdll: Assert when trying to replace an exiting file descriptor in fd_cache.

---

 dlls/ntdll/server.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 2c99cbe..69d01be 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -821,7 +821,6 @@ static BOOL add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
                             unsigned int access, unsigned int options )
 {
     unsigned int entry, idx = handle_to_index( handle, &entry );
-    int prev_fd;
 
     if (entry >= FD_CACHE_ENTRIES)
     {
@@ -841,11 +840,11 @@ static BOOL add_fd_to_cache( HANDLE handle, int fd, enum server_fd_type type,
         }
     }
     /* store fd+1 so that 0 can be used as the unset value */
-    prev_fd = interlocked_xchg( &fd_cache[entry][idx].fd, fd + 1 ) - 1;
+    fd = interlocked_xchg( &fd_cache[entry][idx].fd, fd + 1 );
     fd_cache[entry][idx].type = type;
     fd_cache[entry][idx].access = access;
     fd_cache[entry][idx].options = options;
-    if (prev_fd != -1) close( prev_fd );
+    assert( !fd );
     return TRUE;
 }
 




More information about the wine-cvs mailing list