evil: Fix fcntl for F_SETLK and F_SETLKW wrong length calculation

Summary:
If length and start are both 0, size is wrongfully negative. Besides,
using length as a delimitator in a range means that [0, length) is a
half-closed interval, so we don't need to subtract by 1.

Reviewers: vtorri, woohyun, lucas, jptiz

Reviewed By: vtorri, lucas

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D12208
This commit is contained in:
Felipe Magno de Almeida 2020-12-14 11:48:29 -03:00
parent 4e5b01f8a0
commit 8d2c652104
1 changed files with 1 additions and 1 deletions

View File

@ -114,7 +114,7 @@ fcntl(int fd, int cmd, ...)
if (length != -1L)
res = 0;
}
fl->l_len = length - fl->l_start - 1;
fl->l_len = length - fl->l_start;
pos = _lseek(fd, fl->l_start, fl->l_whence);
if (pos != -1L)