From e3e2c03de3df2edbc6adbdc221c96a10b9c02263 Mon Sep 17 00:00:00 2001 From: "Andrey A. Chernov" Date: Thu, 23 Aug 2001 15:44:24 +0000 Subject: [PATCH] Copy POSIX l_len<0 handling from kern_lockf.c --- sys/fs/smbfs/smbfs_vnops.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index e52adf3f6f4a..bc2a5c337a0a 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -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;