summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2015-10-21 16:09:14 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2015-10-21 16:09:14 +0000
commitc845cd430790ce324139347c44bb6341813d23b8 (patch)
tree3c44574b2eed05a3cc45f4950a8a665e034af94d /sys/kern
parent69cd678032cf7b7946589f062b7e7898fa01f7a4 (diff)
Setting fcntl(F_SETOWN) for a pipe failed with inappropriate ioctl
for device. In sys_fcntl() the ioctl(TIOCSPGRP) is called, but the pipe expects SIOCSPGRP. Sockets have a specal case for the same reason, so adapt the special code for pipes. OK millert@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_descrip.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 6de08b92085..2c1fe0b0a35 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.121 2015/10/16 13:37:43 millert Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.122 2015/10/21 16:09:13 bluhm Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -429,6 +429,10 @@ restart:
*retval = ((struct socket *)fp->f_data)->so_pgid;
break;
}
+ if (fp->f_type == DTYPE_PIPE) {
+ *retval = ((struct pipe *)fp->f_data)->pipe_pgid;
+ break;
+ }
error = (*fp->f_ops->fo_ioctl)
(fp, TIOCGPGRP, (caddr_t)&tmp, p);
*retval = -tmp;
@@ -443,6 +447,12 @@ restart:
so->so_sigeuid = p->p_ucred->cr_uid;
break;
}
+ if (fp->f_type == DTYPE_PIPE) {
+ struct pipe *mpipe = (struct pipe *)fp->f_data;
+
+ mpipe->pipe_pgid = (long)SCARG(uap, arg);
+ break;
+ }
if ((long)SCARG(uap, arg) <= 0) {
SCARG(uap, arg) = (void *)(-(long)SCARG(uap, arg));
} else {