Changeset 187 for Evidence/Evidence.cc
- Timestamp:
- 03/29/10 09:28:17 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Evidence.cc
r178 r187 47 47 signal(SIGINT, &SignalHandler); // CTRL-C 48 48 signal(SIGHUP, &SignalHandler); // Terminal closed 49 49 50 50 // Catch C++ unhandled exceptions 51 51 set_terminate(Terminate); … … 57 57 string Rev(EVIDENCE_REVISION); 58 58 Rev = Rev.substr(1, Rev.size()-3); 59 if (asprintf(&InitMsg, "Server started (%s, compiled %s %s)", Rev.c_str(),__DATE__, __TIME__) == -1) InitMsg = NULL;59 snprintf(InitMsg, sizeof(InitMsg), "Server started (%s, compiled %s %s)", Rev.c_str(),__DATE__, __TIME__); 60 60 61 61 Status = new DimService((ServerName+"/Status").c_str(), (char *) "C", InitMsg, strlen(InitMsg)+1); … … 68 68 EvidenceServer::~EvidenceServer() { 69 69 70 free(InitMsg);71 70 State(INFO, "Server stopped"); 72 71 … … 79 78 // DIM exit handler 80 79 void EvidenceServer::exitHandler(int Code) { 80 81 81 State(INFO, "Exit handler called (DIM exit code %d)", Code); 82 82 exit(EXIT_SUCCESS); … … 181 181 182 182 // Signal handler (causes pause() and other syscalls to return) 183 void EvidenceServer::SignalHandler(int) { 184 185 ThisServer->ExitRequest = true; 183 void EvidenceServer::SignalHandler(int Signal) { 184 185 static bool Called = false; 186 187 if (!Called) { 188 Called = true; 189 ThisServer->ExitRequest = true; 190 return; 191 } 192 193 // If invoked twice, call exit() 194 ThisServer->State(ThisServer->WARN, "Signal handler called again, invoking exit() (signal %d)", Signal); 195 exit(EXIT_FAILURE); 186 196 } 187 197
Note:
See TracChangeset
for help on using the changeset viewer.