Commit d0451f6b authored by Alexander Morozov's avatar Alexander Morozov Committed by Alexandre Julliard

server: Fix overlapping shared and exclusive locks support.

parent db6fe9ee
......@@ -1671,7 +1671,6 @@ static void test_LockFile(void)
ok( !LockFileEx( handle2, LOCKFILE_FAIL_IMMEDIATELY, 0, 100, 0, &overlapped ),
"LockFileEx handle2 300,100 succeeded\n" );
ret = LockFileEx( handle, LOCKFILE_FAIL_IMMEDIATELY, 0, 100, 0, &overlapped );
todo_wine
ok( ret, "LockFileEx 300,100 failed\n" );
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 300,100 failed\n" );
/* exclusive lock is removed first */
......
......@@ -1321,9 +1321,9 @@ static struct file_lock *add_lock( struct fd *fd, int shared, file_pos_t start,
release_object( lock );
return NULL;
}
list_add_head( &fd->locks, &lock->fd_entry );
list_add_head( &fd->inode->locks, &lock->inode_entry );
list_add_head( &lock->process->locks, &lock->proc_entry );
list_add_tail( &fd->locks, &lock->fd_entry );
list_add_tail( &fd->inode->locks, &lock->inode_entry );
list_add_tail( &lock->process->locks, &lock->proc_entry );
return lock;
}
......@@ -1395,7 +1395,7 @@ obj_handle_t lock_fd( struct fd *fd, file_pos_t start, file_pos_t count, int sha
{
struct file_lock *lock = LIST_ENTRY( ptr, struct file_lock, inode_entry );
if (!lock_overlaps( lock, start, end )) continue;
if (lock->shared && shared) continue;
if (shared && (lock->shared || lock->fd == fd)) continue;
/* found one */
if (!wait)
{
......
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