summaryrefslogtreecommitdiff
path: root/pkg/st/patch/0002-Only-send-SIGHUP-on-close-when-using-PTY.patch
blob: f0a0ad7b56ec3943d707a026de3c9868ab16ac00 (plain)
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
From 6ee6144c159551d45f0e02a87b5635c29e48fbbf Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sat, 22 Feb 2020 17:17:01 -0800
Subject: [PATCH] Only send SIGHUP on close when using PTY

Otherwise, pid is at its default value (0), so SIGHUP gets sent to
the entire process group.
---
 st.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/st.c b/st.c
index 913c71b..20a3c3c 100644
--- a/st.c
+++ b/st.c
@@ -4325,8 +4325,10 @@ toplevelconfigure(void *data, struct xdg_toplevel *toplevel, int32_t w, int32_t
 void
 toplevelclose(void *data, struct xdg_toplevel *toplevel)
 {
-	/* Send SIGHUP to shell */
-	kill(pid, SIGHUP);
+	if (pid) {
+		/* Send SIGHUP to shell */
+		kill(pid, SIGHUP);
+	}
 	exit(0);
 }
 
-- 
2.37.3