summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lockf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_lockf.c')
-rw-r--r--sys/kern/kern_lockf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c
index 7e11d65..de8c75d 100644
--- a/sys/kern/kern_lockf.c
+++ b/sys/kern/kern_lockf.c
@@ -133,10 +133,12 @@ lf_advlock(ap, head, size)
if (start < 0)
return (EINVAL);
if (fl->l_len < 0) {
- start += fl->l_len;
- if (start <= 0)
+ if (start == 0)
return (EINVAL);
end = start - 1;
+ start += fl->l_len;
+ if (start < 0)
+ return (EINVAL);
} else if (fl->l_len == 0)
end = -1;
else {
OpenPOWER on IntegriCloud