don't allow non-set commands to be executed outside _Host_Frame because

they can call Host_Error which calls longjmp and it's _Host_Frame that
calls setjmp... fixes the segfault when +connect foo fails
This commit is contained in:
Bill Currie 2004-01-27 06:02:41 +00:00
parent c1a43705da
commit 59101d3272

View file

@ -649,11 +649,12 @@ Host_ClientFrame (void)
static void
_Host_Frame (float time)
{
static int first = 1;
if (setjmp (host_abortserver))
return; // something bad happened, or the
// server disconnected
rand (); // keep the random time dependent
// decide the simulation time
@ -671,6 +672,21 @@ _Host_Frame (float time)
cmd_source = src_command;
Cbuf_Execute_Stack (host_cbuf);
if (first) {
first = 0;
if (isDedicated) {
if (!sv.active)
Cmd_ExecuteString ("map start", src_command);
if (!sv.active)
Sys_Error ("Could not initialize server");
} else {
Con_NewMap ();
}
CL_UpdateScreen (cl.time);
}
NET_Poll ();
if (sv.active) {
@ -993,22 +1009,9 @@ Host_Init (void)
build_number ());
Con_Printf ("\x80\x81\x81\x82 %s initialized\x80\x81\x81\x82\n", PROGRAM);
CL_UpdateScreen (cl.time);
// make sure all + commands have been executed
Cbuf_Execute_Stack (host_cbuf);
host_initialized = true;
if (isDedicated) {
if (!sv.active)
Cmd_ExecuteString ("map start", src_command);
if (!sv.active)
Sys_Error ("Could not initialize server");
} else {
Con_NewMap ();
}
CL_UpdateScreen (cl.time);
}