ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/init.C
(Generate patch)

Comparing deliantra/server/server/init.C (file contents):
Revision 1.28 by pippijn, Wed Jan 3 00:46:53 2007 UTC vs.
Revision 1.29 by root, Fri Jan 5 10:50:47 2007 UTC

1231 1231
1232void 1232void
1233rec_sigsegv (int i) 1233rec_sigsegv (int i)
1234{ 1234{
1235 LOG (llevError, "SIGSEGV received.\n"); 1235 LOG (llevError, "SIGSEGV received.\n");
1236 fatal_signal (1, 1); 1236 cleanup ("SIGSEGV received", 1);
1237} 1237}
1238 1238
1239void 1239void
1240rec_sigint (int i) 1240rec_sigint (int i)
1241{ 1241{
1242 LOG (llevInfo, "SIGINT received.\n"); 1242 LOG (llevInfo, "SIGINT received.\n");
1243 fatal_signal (0, 1); 1243 cleanup ("SIGINT received", 0);
1244} 1244}
1245 1245
1246void 1246void
1247rec_sighup (int i) 1247rec_sighup (int i)
1248{ 1248{
1249 LOG (llevInfo, "SIGHUP received\n"); 1249 LOG (llevInfo, "SIGHUP received\n");
1250 1250
1251 if (init_done) 1251 cleanup ("SIGHUP received", 0);
1252 cleanup (0);
1253
1254 exit (0);
1255} 1252}
1256 1253
1257void 1254void
1258rec_sigquit (int i) 1255rec_sigquit (int i)
1259{ 1256{
1260 LOG (llevInfo, "SIGQUIT received\n"); 1257 LOG (llevInfo, "SIGQUIT received\n");
1261 fatal_signal (1, 1); 1258 cleanup ("SIGQUIT received", 1);
1262} 1259}
1263 1260
1264void 1261void
1265rec_sigbus (int i) 1262rec_sigbus (int i)
1266{ 1263{
1267#ifdef SIGBUS
1268 LOG (llevError, "SIGBUS received\n"); 1264 LOG (llevError, "SIGBUS received\n");
1269 fatal_signal (1, 1); 1265 cleanup ("SIGBUS received", 1);
1270#endif
1271} 1266}
1272 1267
1273void 1268void
1274rec_sigterm (int i) 1269rec_sigterm (int i)
1275{ 1270{
1276 LOG (llevInfo, "SIGTERM received\n"); 1271 LOG (llevInfo, "SIGTERM received\n");
1277 fatal_signal (0, 1); 1272 cleanup ("SIGTERM received", 0);
1278}
1279
1280void
1281fatal_signal (int make_core, int close_sockets)
1282{
1283 cleanup (make_core);
1284} 1273}
1285 1274
1286void 1275void
1287init_signals (void) 1276init_signals (void)
1288{ 1277{
1278 signal (SIGPIPE, SIG_IGN);
1289 signal (SIGHUP, rec_sighup); 1279 signal (SIGHUP, rec_sighup);
1290 signal (SIGINT, rec_sigint); 1280 signal (SIGINT, rec_sigint);
1291 signal (SIGQUIT, rec_sigquit); 1281 signal (SIGQUIT, rec_sigquit);
1292 signal (SIGSEGV, rec_sigsegv); 1282 signal (SIGSEGV, rec_sigsegv);
1293 signal (SIGPIPE, SIG_IGN);
1294#ifdef SIGBUS
1295 signal (SIGBUS, rec_sigbus); 1283 signal (SIGBUS, rec_sigbus);
1296#endif
1297 signal (SIGTERM, rec_sigterm); 1284 signal (SIGTERM, rec_sigterm);
1298} 1285}
1299 1286
1300/* init_races() - reads the races file in the lib/ directory, then 1287/* init_races() - reads the races file in the lib/ directory, then
1301 * overwrites old 'race' entries. This routine allow us to quickly 1288 * overwrites old 'race' entries. This routine allow us to quickly
1302 * re-configure the 'alignment' of monsters, objects. Useful for 1289 * re-configure the 'alignment' of monsters, objects. Useful for
1303 * putting together lists of creatures, etc that belong to gods. 1290 * putting together lists of creatures, etc that belong to gods.
1304 */ 1291 */
1305
1306void 1292void
1307init_races (void) 1293init_races (void)
1308{ 1294{
1309 FILE *file; 1295 FILE *file;
1310 char race[MAX_BUF], fname[MAX_BUF], buf[MAX_BUF], *cp, variable[MAX_BUF]; 1296 char race[MAX_BUF], fname[MAX_BUF], buf[MAX_BUF], *cp, variable[MAX_BUF];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines