diff options
author | 1999-06-08 16:05:22 +0000 | |
---|---|---|
committer | 1999-06-08 16:05:22 +0000 | |
commit | 4b1564403903358324af6f8b033951f077cc1700 (patch) | |
tree | 17903ce9ef4d301bf0bcb23e17ef5949391b0c3c /sys/kern/sys_pipe.c | |
parent | use sys_opipe(), but note the descriptor leakage (diff) | |
download | wireguard-openbsd-4b1564403903358324af6f8b033951f077cc1700.tar.xz wireguard-openbsd-4b1564403903358324af6f8b033951f077cc1700.zip |
better fd leak prevention
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r-- | sys/kern/sys_pipe.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 3b2633c3155..0a3b4733741 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.14 1999/06/07 20:46:09 deraadt Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.15 1999/06/08 16:05:22 deraadt Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -151,34 +151,6 @@ 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__) |