summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/linux/linux_misc.c5
-rw-r--r--sys/kern/sys_pipe.c30
-rw-r--r--sys/kern/uipc_syscalls.c16
3 files changed, 9 insertions, 42 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index c6efe014cd8..04509b7091d 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_misc.c,v 1.22 1999/06/08 15:47:39 deraadt Exp $ */
+/* $OpenBSD: linux_misc.c,v 1.23 1999/06/08 16:05:23 deraadt Exp $ */
/* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */
/*
@@ -656,7 +656,8 @@ linux_sys_pipe(p, v, retval)
#ifdef __i386__
retval[1] = reg_edx;
#endif /* __i386__ */
- /* XXX leaks descriptors */
+ fdrelease(p, retval[0]);
+ fdrelease(p, retval[1]);
return error;
}
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__)
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 8656ccde465..46ceae1ec16 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.23 1999/06/07 20:46:09 deraadt Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.24 1999/06/08 16:05:22 deraadt Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -835,16 +835,12 @@ sys_getsockopt(p, v, retval)
return (error);
}
-
-#ifdef OLD_PIPE
-
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;
@@ -856,16 +852,14 @@ 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;
+ fdrelease(p, retval[0]);
+ fdrelease(p, retval[1]);
}
return (error);
}
+#ifdef OLD_PIPE
+
/* ARGSUSED */
int
sys_opipe(p, v, retval)