server: Try to get a read lock if we can't get a write lock.

This commit is contained in:
Vincent Povirk 2014-05-08 15:03:10 -05:00 committed by Alexandre Julliard
parent cf75c5368b
commit 473a3a47a7
1 changed files with 6 additions and 2 deletions

View File

@ -1175,8 +1175,12 @@ static int set_unix_lock( struct fd *fd, file_pos_t start, file_pos_t end, int t
return 0;
case EBADF:
/* this can happen if we try to set a write lock on a read-only file */
/* we just ignore that error */
if (fl.l_type == F_WRLCK) return 1;
/* try to at least grab a read lock */
if (fl.l_type == F_WRLCK)
{
type = F_RDLCK;
break; /* retry */
}
set_error( STATUS_ACCESS_DENIED );
return 0;
#ifdef EOVERFLOW