mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
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:
parent
c1a43705da
commit
59101d3272
1 changed files with 17 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue