diff options
author | Felipe Magno de Almeida <felipe@expertise.dev> | 2020-12-14 11:48:29 -0300 |
---|---|---|
committer | Felipe Magno de Almeida <felipe@expertise.dev> | 2020-12-14 12:33:32 -0300 |
commit | b495328a30f0b4ca75335fef11d418dff383ec30 (patch) | |
tree | 634b54eb6fb177f4493493d47c3189b2f0592e37 | |
parent | f563b99917ede156ed89fcc7901e42498ab84ef8 (diff) | |
download | efl-b495328a30f0b4ca75335fef11d418dff383ec30.tar.gz |
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
-rw-r--r-- | src/lib/evil/evil_fcntl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/evil/evil_fcntl.c b/src/lib/evil/evil_fcntl.c index 14d10b111c..6c556a6cd7 100644 --- a/src/lib/evil/evil_fcntl.c +++ b/src/lib/evil/evil_fcntl.c @@ -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) |