diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-06-07 20:46:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-06-07 20:46:10 +0000 |
commit | 7085a688fcf058162d1c34a24309035ec3041aea (patch) | |
tree | 88d735b84ad6add88fa16f73bd8bca6a0f84a5b8 | |
parent | b445012ced98c82ff62e42965759a930b18e511a (diff) |
need seperate sys_pipe() versions, for pipeclose() or soclose() calls
-rw-r--r-- | sys/kern/sys_pipe.c | 30 | ||||
-rw-r--r-- | sys/kern/uipc_syscalls.c | 8 |
2 files changed, 35 insertions, 3 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index f14e55a005f..3b2633c3155 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.13 1999/06/07 07:17:42 deraadt Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.14 1999/06/07 20:46:09 deraadt Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -151,6 +151,34 @@ void pipespace __P((struct pipe *)); * The pipe system call for the DTYPE_PIPE type of pipes */ +int +sys_pipe(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + register struct filedesc *fdp = p->p_fd; + register struct sys_pipe_args /* { + syscallarg(int *) fdp; + } */ *uap = v; + int error; + + if ((error = sys_opipe(p, v, retval)) == -1) + return (error); + + error = copyout((caddr_t)retval, (caddr_t)SCARG(uap, fdp), + 2 * sizeof (int)); + if (error) { + pipeclose((struct pipe *)(fdp->fd_ofiles[retval[0]]->f_data)); + ffree(fdp->fd_ofiles[retval[0]]); + fdp->fd_ofiles[retval[0]] = NULL; + pipeclose((struct pipe *)(fdp->fd_ofiles[retval[1]]->f_data)); + ffree(fdp->fd_ofiles[retval[1]]); + fdp->fd_ofiles[retval[1]] = NULL; + } + return (error); +} + /* ARGSUSED */ int #if defined(__FreeBSD__) diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 99a511eaf34..8656ccde465 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.22 1999/06/07 07:17:42 deraadt Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.23 1999/06/07 20:46:09 deraadt Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -835,6 +835,9 @@ sys_getsockopt(p, v, retval) return (error); } + +#ifdef OLD_PIPE + int sys_pipe(p, v, retval) struct proc *p; @@ -853,15 +856,16 @@ sys_pipe(p, v, retval) error = copyout((caddr_t)retval, (caddr_t)SCARG(uap, fdp), 2 * sizeof (int)); if (error) { + soclose((struct socket *)(fdp->fd_ofiles[retval[0]]->f_data)); ffree(fdp->fd_ofiles[retval[0]]); fdp->fd_ofiles[retval[0]] = NULL; + soclose((struct socket *)(fdp->fd_ofiles[retval[1]]->f_data)); ffree(fdp->fd_ofiles[retval[1]]); fdp->fd_ofiles[retval[1]] = NULL; } return (error); } -#ifdef OLD_PIPE /* ARGSUSED */ int sys_opipe(p, v, retval) |