diff options
author | green <green@FreeBSD.org> | 1999-08-04 18:53:50 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-08-04 18:53:50 +0000 |
commit | c03366a55d4ace981b016ae999ae67675c486cdd (patch) | |
tree | 12cd9e195ff9e1b516242767963c6e156b837539 /sys/dev/streams/streams.c | |
parent | 0ab4dad80912358b49a3cee9e433dbd909334d19 (diff) | |
download | FreeBSD-src-c03366a55d4ace981b016ae999ae67675c486cdd.zip FreeBSD-src-c03366a55d4ace981b016ae999ae67675c486cdd.tar.gz |
Fix fd race conditions (during shared fd table usage.) Badfileops is
now used in f_ops in place of NULL, and modifications to the files
are more carefully ordered. f_ops should also be set to &badfileops
upon "close" of a file.
This does not fix other problems mentioned in this PR than the first
one.
PR: 11629
Reviewed by: peter
Diffstat (limited to 'sys/dev/streams/streams.c')
-rw-r--r-- | sys/dev/streams/streams.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c index cd5a6fa..07717d5 100644 --- a/sys/dev/streams/streams.c +++ b/sys/dev/streams/streams.c @@ -30,7 +30,7 @@ * skeleton produced from /usr/share/examples/drivers/make_pseudo_driver.sh * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-). * - * $Id$ + * $Id: streams.c,v 1.8 1999/08/01 12:51:06 newton Exp $ */ #include "streams.h" /* generated file.. defines NSTREAMS */ @@ -251,11 +251,11 @@ streamsopen(dev_t dev, int oflags, int devtype, struct proc *p) return error; } + fp->f_data = (caddr_t)so; fp->f_flag = FREAD|FWRITE; - fp->f_type = DTYPE_SOCKET; fp->f_ops = &svr4_netops; + fp->f_type = DTYPE_SOCKET; - fp->f_data = (caddr_t)so; (void)svr4_stream_get(fp); p->p_dupfd = fd; return ENXIO; @@ -334,13 +334,13 @@ svr4_stream_get(fp) return so->so_emuldata; /* Allocate a new one. */ - fp->f_ops = &svr4_netops; st = malloc(sizeof(struct svr4_strm), M_TEMP, M_WAITOK); st->s_family = so->so_proto->pr_domain->dom_family; st->s_cmd = ~0; st->s_afd = -1; st->s_eventmask = 0; so->so_emuldata = st; + fp->f_ops = &svr4_netops; return st; } |