(exit_nomem): New.

(update_init): New.
(start_server): Call it.
(start_server, update_sched): Move initialization stuff to it, with
error checking added.
(update_sched): Internal linkage.
This commit is contained in:
Markus Armbruster 2007-01-16 19:26:31 +00:00
parent 6cbdd3e02a
commit d38fcc6cf4
5 changed files with 40 additions and 11 deletions

View file

@ -106,7 +106,20 @@ logerror(char *format, ...)
int
oops(char *msg, char *file, int line)
{
logerror("Oops: %s in %s:%d", msg ? msg : "bug", file, line);
if (debug) abort();
return 1;
logerror("Oops: %s in %s:%d", msg ? msg : "bug", file, line);
if (debug) abort();
return 1;
}
/*
* Report out-of-memory condition and terminate the program.
* Use this with restraint! Clean error recovery is preferable, but
* not always feasible (e.g. halfway through the update) or worthwhile
* (during server startup).
*/
void
exit_nomem(void)
{
logerror("Memory exhausted");
exit(1);
}