mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
use compliant sig_atomic_t for signal handler, use _Exit
This commit is contained in:
parent
a69852bdfc
commit
259a449b67
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
volatile bool InterruptSignaled = false;
|
volatile sig_atomic_t InterruptSignaled = 0;
|
||||||
|
|
||||||
CSnapIDPool::CSnapIDPool()
|
CSnapIDPool::CSnapIDPool()
|
||||||
{
|
{
|
||||||
|
@ -3608,9 +3608,9 @@ static CServer *CreateServer() { return new CServer(); }
|
||||||
void HandleSigInt(int Param)
|
void HandleSigInt(int Param)
|
||||||
{
|
{
|
||||||
if(InterruptSignaled)
|
if(InterruptSignaled)
|
||||||
exit(1);
|
_Exit(1); // exit is not async-signal-safe and must not be called from a signal handler
|
||||||
else
|
else
|
||||||
InterruptSignaled = true;
|
InterruptSignaled = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char **argv) // ignore_convention
|
int main(int argc, const char **argv) // ignore_convention
|
||||||
|
|
Loading…
Reference in a new issue