File: restore-signal-handlers.patch

package info (click to toggle)
dvtm 0.15%2B40.g311a8c0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 428 kB
  • sloc: ansic: 6,212; makefile: 163; sh: 76
file content (53 lines) | stat: -rw-r--r-- 1,305 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Description: Restore default signal handlers for child processes
Author: Dmitry Bogatov <KAction@gnu.org>
Forwarded: no
Last-Update: 2016-12-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/vt.c
+++ b/vt.c
@@ -17,13 +17,13 @@
  */
 #include <stdlib.h>
 #include <stdint.h>
+#include <signal.h>
 #include <unistd.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <langinfo.h>
 #include <limits.h>
-#include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -31,6 +31,7 @@
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <termios.h>
+#include <signal.h>
 #include <wchar.h>
 #if defined(__linux__) || defined(__CYGWIN__)
 # include <pty.h>
@@ -1583,6 +1584,13 @@ void vt_noscroll(Vt *t)
 		vt_scroll(t, scroll_below);
 }
 
+static void reset_sigdfl()
+{
+	int signum;
+	for (signum = 0; signum != _NSIG; ++signum)
+		signal(signum, SIG_DFL);
+}
+
 pid_t vt_forkpty(Vt *t, const char *p, const char *argv[], const char *cwd, const char *env[], int *to, int *from)
 {
 	int vt2ed[2], ed2vt[2];
@@ -1635,6 +1643,7 @@ pid_t vt_forkpty(Vt *t, const char *p, c
 		if (cwd)
 			chdir(cwd);
 
+		reset_sigdfl();
 		execvp(p, (char *const *)argv);
 		fprintf(stderr, "\nexecv() failed.\nCommand: '%s'\n", argv[0]);
 		exit(1);