diff options
author | Bruno Haible <bruno@clisp.org> | 2011-09-28 00:49:04 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-09-28 00:49:55 +0200 |
commit | f34d6c82b0a9bee880de32ef42d5f38bf69519b0 (patch) | |
tree | a979580da2c52f5f068f242602d33e756faacb91 /lib/raise.c | |
parent | b67341dde811a0fb9fbd41c2f65bdd5dfa6da142 (diff) | |
download | gnulib-f34d6c82b0a9bee880de32ef42d5f38bf69519b0.tar.gz |
raise: Fix double declaration with modules 'sigprocmask' and 'sigpipe'.
* lib/signal.in.h (GNULIB_defined_signal_blocking): New macro.
(raise): Remove older, duplicated declaration.
(_gl_raise_SIGPIPE): New declaration.
* lib/sigprocmask.c (_gl_raise_SIGPIPE): New function.
(rpl_raise): Remove function.
* lib/raise.c (rpl_raise, raise): Merge into a single function. Handle
a gnulib-defined SIGPIPE here.
* m4/raise.m4 (gl_FUNC_RAISE): Set REPLACE_RAISE also if the module
'sigprocmask' has detected missing signal-blocking and the module
'sigpipe' is enabled.
Reported by Tatsuro MATSUOKA <tmacchant5@yahoo.co.jp>.
Diffstat (limited to 'lib/raise.c')
-rw-r--r-- | lib/raise.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/raise.c b/lib/raise.c index 980c9fd488..aee33e885e 100644 --- a/lib/raise.c +++ b/lib/raise.c @@ -50,24 +50,30 @@ raise_nothrow (int sig) return result; } -# define raise raise_nothrow +# else +# define raise_nothrow raise # endif -int -rpl_raise (int sig) -{ - return raise_nothrow (sig); -} - #else /* An old Unix platform. */ # include <unistd.h> +# define rpl_raise raise + +#endif + int -raise (int sig) +rpl_raise (int sig) { - return kill (getpid (), sig); -} +#if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE + if (sig == SIGPIPE) + return _gl_raise_SIGPIPE (); +#endif +#if HAVE_RAISE + return raise_nothrow (sig); +#else + return kill (getpid (), sig); #endif +} |