Don't assume SIGPIPE exists, and that sigblock and sigsetmask

exist if sigprocmask does not.  Problem reported by Paul Edwards
for MVS 3.8.
* configure.ac (sigblock): Check whether this function is
available, if sigprocmask is not.
* src/sdiff.c (sigs): Omit SIGPIPE if it's not defined.
Put SIGINT last; all uses changed.
(handler_index_of_SIGPIPE): Omit if SIGPIPE is not defined.
(sigblock, sigsetmask) [!HAVE_SIGBLOCK]: New macros.
This commit is contained in:
Paul Eggert 2006-11-14 20:22:12 +00:00
parent 6bd6999fed
commit 1795be71fb
3 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,15 @@
2006-11-14 Paul Eggert <eggert@cs.ucla.edu>
Don't assume SIGPIPE exists, and that sigblock and sigsetmask
exist if sigprocmask does not. Problem reported by Paul Edwards
for MVS 3.8.
* configure.ac (sigblock): Check whether this function is
available, if sigprocmask is not.
* src/sdiff.c (sigs): Omit SIGPIPE if it's not defined.
Put SIGINT last; all uses changed.
(handler_index_of_SIGPIPE): Omit if SIGPIPE is not defined.
(sigblock, sigsetmask) [!HAVE_SIGBLOCK]: New macros.
2006-11-04 Paul Eggert <eggert@cs.ucla.edu>
* src/sdiff.c (sigprocmask) [! HAVE_SIGPROCMASK]: Cast 2nd arg to

View File

@ -54,6 +54,9 @@ AC_HEADER_SYS_WAIT
AC_TYPE_PID_T
AC_CHECK_FUNCS_ONCE([sigaction sigprocmask strcasecoll stricoll])
if test $ac_cv_func_sigprocmask = no; then
AC_CHECK_FUNCS([sigblock])
fi
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_FORK

View File

@ -81,11 +81,13 @@ static int const sigs[] = {
#ifdef SIGXFSZ
SIGXFSZ,
#endif
SIGINT,
SIGPIPE
#ifdef SIGPIPE
SIGPIPE,
# define handler_index_of_SIGPIPE (NUM_SIGS - 2)
#endif
SIGINT
#define handler_index_of_SIGINT (NUM_SIGS - 1)
};
#define handler_index_of_SIGINT (NUM_SIGS - 2)
#define handler_index_of_SIGPIPE (NUM_SIGS - 1)
#if HAVE_SIGACTION
/* Prefer `sigaction' if available, since `signal' can lose signals. */
@ -111,6 +113,10 @@ static int const sigs[] = {
# ifndef SIG_SETMASK
# define SIG_SETMASK (! SIG_BLOCK)
# endif
# if ! HAVE_SIGBLOCK
# define sigblock(mask) (mask)
# define sigsetmask(mask) (mask)
# endif
# define sigprocmask(how, n, o) \
((how) == SIG_BLOCK \
? *(sigset_t *) (o) = sigblock (*(n)) \