about summary refs log tree commit diff
path: root/src/signal/siginterrupt.c
blob: 94f92be6aae4b53d349ff12a291bac060aa2acd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stddef.h>
#include <signal.h>

int siginterrupt(int sig, int flag)
{
	struct sigaction sa;

	sigaction(sig, NULL, &sa);
	if (flag) sa.sa_flags &= ~SA_RESTART;
	else sa.sa_flags |= SA_RESTART;

	return sigaction(sig, &sa, NULL);
}