Commit bf65fef8 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

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

parent 36bc8563
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment