summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/src/ape/lib/ap/plan9/_buf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/src/ape/lib/ap/plan9/_buf.c b/sys/src/ape/lib/ap/plan9/_buf.c
index 185095c8c..5cfa8d19d 100644
--- a/sys/src/ape/lib/ap/plan9/_buf.c
+++ b/sys/src/ape/lib/ap/plan9/_buf.c
@@ -54,14 +54,19 @@ _startbuf(int fd)
Fdinfo *f;
Muxbuf *b;
void *v;
+ Muxseg *m;
if(mux == 0){
- _RFORK(RFREND);
- mux = (Muxseg*)_SEGATTACH(0, "shared", 0, sizeof(Muxseg));
- if(mux == (void*)-1){
+ if(_RFORK(RFREND) == -1){
_syserrno();
return -1;
}
+ m = (Muxseg*)_SEGATTACH(0, "shared", 0, sizeof(Muxseg));
+ if(m == (void*)-1){
+ _syserrno();
+ return -1;
+ }
+ mux = m;
/* segattach has returned zeroed memory */
atexit(_killmuxsid);
}