aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-09-11 16:56:48 +0200
committerErlang/OTP <[email protected]>2018-09-11 16:56:48 +0200
commitc13ac2b7d63fcae7f87d2f848a46c3b94a700849 (patch)
treeb57c3cd18ad0dcd0e638742fcb3d75742dc38dac
parent30e5321740b96b3a8984611b6f821692716d0555 (diff)
parentda4c24bf8fc7bb2ee0d0a66d9fcfe6344d7c0c8a (diff)
downloadotp-c13ac2b7d63fcae7f87d2f848a46c3b94a700849.tar.gz
otp-c13ac2b7d63fcae7f87d2f848a46c3b94a700849.tar.bz2
otp-c13ac2b7d63fcae7f87d2f848a46c3b94a700849.zip
Merge branch 'rickard/port-prog-sigterm-fix/OTP-15289' into maint-21
* rickard/port-prog-sigterm-fix/OTP-15289: Restore default SIGTERM behaviour for port programs
-rw-r--r--erts/emulator/sys/unix/erl_child_setup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/erts/emulator/sys/unix/erl_child_setup.c b/erts/emulator/sys/unix/erl_child_setup.c
index 221ee2a69d..129861ebd5 100644
--- a/erts/emulator/sys/unix/erl_child_setup.c
+++ b/erts/emulator/sys/unix/erl_child_setup.c
@@ -133,6 +133,7 @@ static int sigchld_pipe[2];
static int
start_new_child(int pipes[])
{
+ struct sigaction sa;
int errln = -1;
int size, res, i, pos = 0;
char *buff, *o_buff;
@@ -143,6 +144,16 @@ start_new_child(int pipes[])
/* only child executes here */
+ /* Restore default handling of sigterm... */
+ sa.sa_handler = SIG_DFL;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+
+ if (sigaction(SIGTERM, &sa, 0) == -1) {
+ perror(NULL);
+ exit(1);
+ }
+
do {
res = read(pipes[0], (char*)&size, sizeof(size));
} while(res < 0 && (errno == EINTR || errno == ERRNO_BLOCK));