I'm trying to write a program that stays in an infinite loop, and can not be interrupted by the SIGINT (^ C keypad) signal.
What I have so far is the following code:
void sigint();
int main()
{
int pid;
pid = fork();
if(pid == -1)
{
perror("fork");
exit(1);
}
if(pid == 0)
{
signal(SIGINT, SIG_IGN);
}
else
{
sleep(3);
printf("\nPARENT: sending SIGINT\n\n");
kill(pid,SIGINT);
}
void sigint()
{ while(1);}