Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Jul 29, 2024
1 parent f29b08e commit 3dd6f45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
#include "signals.h"

int signal_sethandler(
const int signal,
const int code,
SIGNAL_HANDLER_RETURN (*handler)(SIGNAL_HANDLER_ARGS)
) {

#if defined(_WIN32)

if (signal(code, handler) == SIG_ERR) {
return -1;
}
#else
const struct sigaction action = {
.sa_handler = handler
};

if (sigaction(signal, &action, NULL) == -1) {
if (sigaction(code, &action, NULL) == -1) {
return -1;
}
#endif
Expand Down

0 comments on commit 3dd6f45

Please sign in to comment.