summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-11-26 10:43:24 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2022-11-26 10:44:44 -0800
commitac6115cfb3a71be3a472835d420fbef24cd4889a (patch)
tree7411f73e0c8270fc2bed9bd9d2513cb5ddff183c /m4
parent835b3ea801782fcf72ef1f9397bb112cac0e2f50 (diff)
downloadgnulib-ac6115cfb3a71be3a472835d420fbef24cd4889a.tar.gz
Prefer "kill -INT" to killing with a number
* m4/pthread_sigmask.m4 (gl_FUNC_PTHREAD_SIGMASK): * tests/test-login_tty.c (main): * tests/test-pthread_sigmask1.c (main): * tests/test-sigprocmask.c (main): Prefer "kill -INT" to "kill -N" where N is SIGINT’s value. Don’t assume pid_t fits in int.
Diffstat (limited to 'm4')
-rw-r--r--m4/pthread_sigmask.m47
1 files changed, 5 insertions, 2 deletions
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index 0aa8c53f9e..8282a371e4 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -215,6 +215,7 @@ int main ()
LIBS="$LIBS $LIBMULTITHREAD"])
AC_RUN_IFELSE(
[AC_LANG_SOURCE([[
+#include <limits.h>
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
@@ -230,14 +231,16 @@ sigint_handler (int sig)
int main ()
{
sigset_t set;
- int pid = getpid ();
+ pid_t pid = getpid ();
char command[80];
+ if (LONG_MAX < pid)
+ return 6;
signal (SIGINT, sigint_handler);
sigemptyset (&set);
sigaddset (&set, SIGINT);
if (!(pthread_sigmask (SIG_BLOCK, &set, NULL) == 0))
return 1;
- sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, pid);
+ sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
if (!(system (command) == 0))
return 2;
sleep (2);