summaryrefslogtreecommitdiff
path: root/src/sig.c
blob: 9830f20a602fbebf76b42c8129a971c91f90e6f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// SPDX-FileCopyrightText: 2024 Lizzy Fleckenstein <lizzy@vlhl.dev>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

#include <signal.h>
#include <stddef.h>
#include "sig.h"

bool signal_stop = false;

static void handle_signal(int sig)
{
	(void) sig;
	signal_stop = true;
}

void signal_setup()
{
	struct sigaction sa;
	sa.sa_handler = &handle_signal;
	sigaction(SIGINT, &sa, NULL);
	sigaction(SIGTERM, &sa, NULL);
}