Copy POSIX l_len<0 handling from kern_lockf.c

This commit is contained in:
Andrey A. Chernov 2001-08-23 15:44:24 +00:00
parent f510e1c2ec
commit e3e2c03de3

View File

@ -980,8 +980,6 @@ smbfs_advlock(ap)
off_t start, end;
int error, lkop;
if (fl->l_len < 0)
return EINVAL;
if (vp->v_type == VDIR) {
/*
* SMB protocol have no support for directory locking.
@ -1009,7 +1007,12 @@ smbfs_advlock(ap)
}
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;