server: Fix overlapping shared and exclusive locks support.
This commit is contained in:
parent
db6fe9ee9b
commit
d0451f6b3f
|
@ -1671,7 +1671,6 @@ static void test_LockFile(void)
|
||||||
ok( !LockFileEx( handle2, LOCKFILE_FAIL_IMMEDIATELY, 0, 100, 0, &overlapped ),
|
ok( !LockFileEx( handle2, LOCKFILE_FAIL_IMMEDIATELY, 0, 100, 0, &overlapped ),
|
||||||
"LockFileEx handle2 300,100 succeeded\n" );
|
"LockFileEx handle2 300,100 succeeded\n" );
|
||||||
ret = LockFileEx( handle, LOCKFILE_FAIL_IMMEDIATELY, 0, 100, 0, &overlapped );
|
ret = LockFileEx( handle, LOCKFILE_FAIL_IMMEDIATELY, 0, 100, 0, &overlapped );
|
||||||
todo_wine
|
|
||||||
ok( ret, "LockFileEx 300,100 failed\n" );
|
ok( ret, "LockFileEx 300,100 failed\n" );
|
||||||
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 300,100 failed\n" );
|
ok( UnlockFileEx( handle, 0, 100, 0, &overlapped ), "UnlockFileEx 300,100 failed\n" );
|
||||||
/* exclusive lock is removed first */
|
/* 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 );
|
release_object( lock );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
list_add_head( &fd->locks, &lock->fd_entry );
|
list_add_tail( &fd->locks, &lock->fd_entry );
|
||||||
list_add_head( &fd->inode->locks, &lock->inode_entry );
|
list_add_tail( &fd->inode->locks, &lock->inode_entry );
|
||||||
list_add_head( &lock->process->locks, &lock->proc_entry );
|
list_add_tail( &lock->process->locks, &lock->proc_entry );
|
||||||
return lock;
|
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 );
|
struct file_lock *lock = LIST_ENTRY( ptr, struct file_lock, inode_entry );
|
||||||
if (!lock_overlaps( lock, start, end )) continue;
|
if (!lock_overlaps( lock, start, end )) continue;
|
||||||
if (lock->shared && shared) continue;
|
if (shared && (lock->shared || lock->fd == fd)) continue;
|
||||||
/* found one */
|
/* found one */
|
||||||
if (!wait)
|
if (!wait)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue