bug-gnulib
[Top][All Lists]
Advanced

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

Re: sigaction test failure on FreeBSD 9.1 when pthread is used


From: Paul Eggert
Subject: Re: sigaction test failure on FreeBSD 9.1 when pthread is used
Date: Thu, 25 Apr 2013 13:23:23 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

On 04/25/13 12:07, Ed Maste wrote:
> I don't have a 9.1-RELEASE machine handy, but get the expected zero
> return from this test program on the following FreeBSD versions (one
> before and one after 9.1-RELEASE):

I guess my test case wasn't a correct simplification of
the gnulib test case.  Could you please try the following
test case instead?  Thanks.

#include <signal.h>
#include <stdio.h>
#include <unistd.h>

static void
handler (int sig)
{
  struct sigaction sa;
  if (sigaction (SIGABRT, 0, &sa) != 0)
    perror ("handler sigaction"), _exit (1);
  if (sa.sa_flags & SA_SIGINFO)
    {
      static char const msg[] = "handler sigaction wrongly reports 
SA_SIGINFO\n";
      write (STDERR_FILENO, msg, sizeof msg - 1);
      _exit (1);
    }
  if (sa.sa_handler != SIG_DFL)
    {
      static char const msg[] = "handler sa_handler is not SIG_DFL\n";
      write (STDERR_FILENO, msg, sizeof msg - 1);
      _exit (1);
    }
}

int
main (void)
{
  struct sigaction sa;
  sa.sa_flags = SA_RESETHAND | SA_NODEFER;
  sa.sa_handler = handler;
  if (sigemptyset (&sa.sa_mask) != 0)
    return perror ("sigemptyset"), 1;
  if (sigaction (SIGABRT, &sa, 0) != 0)
    return perror ("sigaction"), 1;
  if (raise (SIGABRT) != 0)
    return perror ("raise"), 1;
  return 0;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]