summaryrefslogtreecommitdiff
path: root/src/win32/sigaction/sigaction.cpp
blob: 51615cf39a1aca8c72c00f09af055d82e3b65f70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 /* POSIX emulation layer for Windows.
 *
 * Copyright (C) 2008-2014 Anope Team <team@anope.org>
 *
 * Please read COPYING and README for further details.
 *
 * Based on the original code of Epona by Lara.
 * Based on the original code of Services by Andy Church.
 */

 #include <windows.h>
 #include "sigaction.h"
 #include <signal.h>

 int sigaction(int sig, struct sigaction *action, struct sigaction *old)
 {
	if (sig == -1)
		return 0;
	if (old == NULL)
	{
		if (signal(sig, SIG_DFL) == SIG_ERR)
			return -1;
	}
	else
	{
		if (signal(sig, action->sa_handler) == SIG_ERR)
			return -1;
	}
	return 0;
 }