diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-10-26 12:03:29 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-10-26 12:03:29 +0000 |
commit | eb46b9853439c27012a22a86f3d9139930a9e87a (patch) | |
tree | 0668f2d444b8c90d902fc4d94aaf484b512bab93 /sys/kern/uipc_syscalls.c | |
parent | 322ae2c6b01056eccf34722ee78713e1b3337123 (diff) |
- every new fd created by falloc() is marked as larval and should not be used
any anyone. Every caller of falloc matures the fd when it's usable.
- Since every lookup in the fd table must now check this flag and all of
them do the same thing, move all the necessary checks into a function -
fd_getfile.
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 28ef6de78ee..c25ad2915ca 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.42 2001/09/20 17:02:31 mpech Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.43 2001/10/26 12:03:27 art Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -91,6 +91,7 @@ sys_socket(p, v, retval) ffree(fp); } else { fp->f_data = (caddr_t)so; + FILE_SET_MATURE(fp); *retval = fd; } return (error); @@ -230,6 +231,7 @@ sys_accept(p, v, retval) } m_freem(nam); splx(s); + FILE_SET_MATURE(fp); return (error); } @@ -336,6 +338,8 @@ sys_socketpair(p, v, retval) } error = copyout((caddr_t)sv, (caddr_t)SCARG(uap, rsv), 2 * sizeof (int)); + FILE_SET_MATURE(fp1); + FILE_SET_MATURE(fp2); if (error == 0) return (error); free4: @@ -1075,8 +1079,7 @@ getsock(fdp, fdes, fpp) { register struct file *fp; - if ((unsigned)fdes >= fdp->fd_nfiles || - (fp = fdp->fd_ofiles[fdes]) == NULL) + if ((fp = fd_getfile(fdp, fdes)) == NULL) return (EBADF); if (fp->f_type != DTYPE_SOCKET) return (ENOTSOCK); |