NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD and sigaction(2)



In article <20100511154258.2010a8af.cryintothebluesky%googlemail.com@localhost>,
Sad Clouds  <cryintothebluesky%googlemail.com@localhost> wrote:
>Hi, I have a small test program that needs to ignore SIGPIPE
>
>This works when calling sigset() function:
>
>sigset(SIGPIPE, SIG_IGN);
>
>
>However if I try to do the same with sigaction(), for some reason
>SIGPIPE is not ignored, and the test program terminates:
>
>struct sigaction sigact;
>
>sigact.sa_flags = 0;
>sigact.sa_handler = SIG_IGN;
>sigact.sa_sigaction = NULL;
>sigemptyset(&sigact.sa_mask);
>
>sigaction(SIGPIPE, &sigact, NULL);
>
>
>Am I doing something wrong, or it's a problem with sigaction?

Yes, sa_handler and sa_sigaction are the same field, so set only one of
them. You should only touch sa_sigaction if you are using siginfo.

delete:
    >sigact.sa_sigaction = NULL;

christos




Home | Main Index | Thread Index | Old Index