diff options
author | Niels Provos <provos@cvs.openbsd.org> | 1999-07-13 15:17:54 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 1999-07-13 15:17:54 +0000 |
commit | d0e661be14492b0bc5cc1cd3252e0a4302c8a350 (patch) | |
tree | de457786be963b3322bbd360c2a883f7466231fe /sys/kern/uipc_syscalls.c | |
parent | 7bb26b9d5348995f3970820e647e2058c0fa94c9 (diff) |
introduce fdremove() to mark a file descriptor as unused. fdremove makes
sure that the fd_freefile hints stay in sync, otherwise free file
descriptors might not be overlooked by fdalloc(); ok millert@
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 11ac934a883..555cddb2b52 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.27 1999/06/15 17:46:32 deraadt Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.28 1999/07/13 15:17:51 provos Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -85,7 +85,7 @@ sys_socket(p, v, retval) error = socreate(SCARG(uap, domain), &so, SCARG(uap, type), SCARG(uap, protocol)); if (error) { - fdp->fd_ofiles[fd] = NULL; + fdremove(fdp, fd); ffree(fp); } else { fp->f_data = (caddr_t)so; @@ -328,10 +328,10 @@ sys_socketpair(p, v, retval) return (error); free4: ffree(fp2); - fdp->fd_ofiles[sv[1]] = NULL; + fdremove(fdp, sv[1]); free3: ffree(fp1); - fdp->fd_ofiles[sv[0]] = NULL; + fdremove(fdp, sv[0]); free2: (void)soclose(so2); free1: @@ -898,10 +898,10 @@ sys_opipe(p, v, retval) return (0); free4: ffree(wf); - fdp->fd_ofiles[retval[1]] = NULL; + fdremove(fdp, retval[1]); free3: ffree(rf); - fdp->fd_ofiles[retval[0]] = NULL; + fdremove(fdp, retval[0]); free2: (void)soclose(wso); free1: |