mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 02:13:38 +00:00
server: Don't crash when trying to set a file lock on a device.
This commit is contained in:
parent
332d14953b
commit
60901b7542
12
server/fd.c
12
server/fd.c
|
@ -1184,12 +1184,6 @@ static struct file_lock *add_lock( struct fd *fd, int shared, file_pos_t start,
|
|||
{
|
||||
struct file_lock *lock;
|
||||
|
||||
if (!fd->inode) /* not a regular file */
|
||||
{
|
||||
set_error( STATUS_INVALID_HANDLE );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(lock = alloc_object( &file_lock_ops ))) return NULL;
|
||||
lock->shared = shared;
|
||||
lock->start = start;
|
||||
|
@ -1259,6 +1253,12 @@ obj_handle_t lock_fd( struct fd *fd, file_pos_t start, file_pos_t count, int sha
|
|||
struct list *ptr;
|
||||
file_pos_t end = start + count;
|
||||
|
||||
if (!fd->inode) /* not a regular file */
|
||||
{
|
||||
set_error( STATUS_INVALID_DEVICE_REQUEST );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* don't allow wrapping locks */
|
||||
if (end && end < start)
|
||||
{
|
||||
|
|
|
@ -4246,6 +4246,7 @@ static const struct
|
|||
{ "ILLEGAL_FUNCTION", STATUS_ILLEGAL_FUNCTION },
|
||||
{ "INSTANCE_NOT_AVAILABLE", STATUS_INSTANCE_NOT_AVAILABLE },
|
||||
{ "INVALID_CID", STATUS_INVALID_CID },
|
||||
{ "INVALID_DEVICE_REQUEST", STATUS_INVALID_DEVICE_REQUEST },
|
||||
{ "INVALID_FILE_FOR_SECTION", STATUS_INVALID_FILE_FOR_SECTION },
|
||||
{ "INVALID_HANDLE", STATUS_INVALID_HANDLE },
|
||||
{ "INVALID_PARAMETER", STATUS_INVALID_PARAMETER },
|
||||
|
|
Loading…
Reference in a new issue