Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F140150499
D24255.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D24255.diff
View Options
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -376,5 +376,7 @@
} */ *ap;
{
- return (ap->a_flags & F_FLOCK ? EOPNOTSUPP : EINVAL);
+ if ((ap->a_flags & F_FLOCK) == 0)
+ return (EINVAL);
+ return (vop_stdadvlock(ap));
}
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -3560,11 +3560,15 @@
error = fget(td, uap->fd, &cap_flock_rights, &fp);
if (error != 0)
return (error);
- if (fp->f_type != DTYPE_VNODE || fp->f_ops == &path_fileops) {
- fdrop(fp, td);
- return (EOPNOTSUPP);
+ error = EOPNOTSUPP;
+ if (fp->f_type != DTYPE_VNODE && fp->f_type != DTYPE_FIFO) {
+ goto done;
+ }
+ if (fp->f_ops == &path_fileops) {
+ goto done;
}
+ error = 0;
vp = fp->f_vnode;
lf.l_whence = SEEK_SET;
lf.l_start = 0;
@@ -3573,7 +3577,7 @@
lf.l_type = F_UNLCK;
atomic_clear_int(&fp->f_flag, FHASLOCK);
error = VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
- goto done2;
+ goto done;
}
if (uap->how & LOCK_EX)
lf.l_type = F_WRLCK;
@@ -3581,12 +3585,12 @@
lf.l_type = F_RDLCK;
else {
error = EBADF;
- goto done2;
+ goto done;
}
atomic_set_int(&fp->f_flag, FHASLOCK);
error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf,
(uap->how & LOCK_NB) ? F_FLOCK : F_FLOCK | F_WAIT);
-done2:
+done:
fdrop(fp, td);
return (error);
}
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1829,7 +1829,7 @@
vp = fp->f_vnode;
fp->f_ops = &badfileops;
- ref = (fp->f_flag & FHASLOCK) != 0 && fp->f_type == DTYPE_VNODE;
+ ref = (fp->f_flag & FHASLOCK) != 0;
error = vn_close1(vp, fp->f_flag, fp->f_cred, td, ref);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 21, 9:31 PM (8 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27122349
Default Alt Text
D24255.diff (1 KB)
Attached To
Mode
D24255: Allow flock() on fifos
Attached
Detach File
Event Timeline
Log In to Comment