diff options
author | ache <ache@FreeBSD.org> | 2001-08-23 15:40:30 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2001-08-23 15:40:30 +0000 |
commit | ffadfe832fd5364e9e82627721c1c0094a3207b5 (patch) | |
tree | 7c7521aa9f1cc8076beb10fb62a85df0ddb7271d /sys/kern/kern_lockf.c | |
parent | a8a18524aa8fc683a1631a1afd4dd9768cef7029 (diff) | |
download | FreeBSD-src-ffadfe832fd5364e9e82627721c1c0094a3207b5.zip FreeBSD-src-ffadfe832fd5364e9e82627721c1c0094a3207b5.tar.gz |
Originally BSD return EINVAL for l_len < 0, but now POSIX wants it too,
so implement POSIX l_len < 0 handling.
Diffstat (limited to 'sys/kern/kern_lockf.c')
-rw-r--r-- | sys/kern/kern_lockf.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index cd51d5c..7e11d65 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -106,8 +106,6 @@ lf_advlock(ap, head, size) off_t start, end; int error; - if (fl->l_len < 0) - return (EINVAL); /* * Convert the flock structure into a start and end. */ @@ -134,7 +132,12 @@ lf_advlock(ap, head, size) } if (start < 0) return (EINVAL); - if (fl->l_len == 0) + if (fl->l_len < 0) { + start += fl->l_len; + if (start <= 0) + return (EINVAL); + end = start - 1; + } else if (fl->l_len == 0) end = -1; else { off_t oadd = fl->l_len - 1; |