server: Fix overlapping shared and exclusive locks support.

This commit is contained in:
Alexander Morozov 2011-10-12 14:58:57 +04:00 committed by Alexandre Julliard
parent db6fe9ee9b
commit d0451f6b3f
2 changed files with 4 additions and 5 deletions

View File

@ -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 */

View File

@ -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)
{