X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fsigaction.c;h=e14bd9647e5b43f259ccd6ae348518522192a21a;hb=969fe755730d23ba7ff21ae7511f66067d0a94d8;hp=1bad8092f2795077329db8ed282fbcfca6872805;hpb=371a3a2d058f3709baeeb0dbe18ae21ddb11ea90;p=gnulib.git diff --git a/lib/sigaction.c b/lib/sigaction.c index 1bad8092f..e14bd9647 100644 --- a/lib/sigaction.c +++ b/lib/sigaction.c @@ -1,5 +1,5 @@ /* POSIX compatible signal blocking. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. Written by Eric Blake , 2008. This program is free software: you can redistribute it and/or modify @@ -64,6 +64,14 @@ # define SIGSTOP (-1) #endif +/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias + for the signal SIGABRT. Only one signal handler is stored for both + SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# undef SIGABRT_COMPAT +# define SIGABRT_COMPAT 6 +#endif + /* A signal handler. */ typedef void (*handler_t) (int signal); @@ -83,7 +91,7 @@ sigaction_handler (int sig) { /* Unexpected situation; be careful to avoid recursive abort. */ if (sig == SIGABRT) - signal (SIGABRT, SIG_DFL); + signal (SIGABRT, SIG_DFL); abort (); } @@ -134,6 +142,11 @@ sigaction (int sig, const struct sigaction *restrict act, return -1; } + #ifdef SIGABRT_COMPAT + if (sig == SIGABRT_COMPAT) + sig = SIGABRT; + #endif + /* POSIX requires sigaction() to be async-signal-safe. In other words, if an asynchronous signal can occur while we are anywhere inside this function, the user's handler could then call