diff options
author | 1999-06-07 20:46:09 +0000 | |
---|---|---|
committer | 1999-06-07 20:46:09 +0000 | |
commit | 49578dfdb42e71565bfcb3c63f382128b5c33169 (patch) | |
tree | 40c89832a9a711395445a61f1e2096906578e122 /sys/kern/sys_pipe.c | |
parent | return a ICMP_UNREACH_PROTOCOL for protocols we do not support; discussion with cmetz (diff) | |
download | wireguard-openbsd-49578dfdb42e71565bfcb3c63f382128b5c33169.tar.xz wireguard-openbsd-49578dfdb42e71565bfcb3c63f382128b5c33169.zip |
need seperate sys_pipe() versions, for pipeclose() or soclose() calls
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r-- | sys/kern/sys_pipe.c | 30 |
1 files changed, 29 insertions, 1 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__) |