ref: f6e305ace571c6844058c0ea0d468ac9c66cb878
parent: be6750ad938eef446ba2f82db0cf602c000cffed
author: qwx <>
date: Sun Jan 13 05:23:44 EST 2019
qk3ded: fix using channels before being allocated
--- a/code/unix/qk3ded.c
+++ b/code/unix/qk3ded.c
@@ -114,6 +114,8 @@
return eventQue[ ( eventTail - 1 ) & MASK_QUED_EVENTS ];
}
+ sleep(1);
+
// create an empty event to return
memset( &ev, 0, sizeof( ev ) );
@@ -149,6 +151,9 @@
int i, len;
char *args;
+ if((echan = chancreate(sizeof(int), 1)) == nil
+ || (inchan = chancreate(sizeof(void *), 2)) == nil)
+ sysfatal("chancreate: %r");
Sys_SetDefaultCDPath(argv[0]);
/* FIXME: no. */
for(len=1, i=1; i<argc; i++)
@@ -161,9 +166,6 @@
}
Com_Init(args);
NET_Init();
- if((echan = chancreate(sizeof(int), 1)) == nil
- || (inchan = chancreate(sizeof(void *), 2)) == nil)
- sysfatal("chancreate: %r");
if(proccreate(cproc, nil, 8192) < 0)
sysfatal("proccreate iproc: %r");
setfcr(getfcr() & ~(FPINVAL|FPZDIV));