summaryrefslogtreecommitdiff
path: root/pkg/st/patch/0002-Only-send-SIGHUP-on-close-when-using-PTY.patch
blob: 50ead2f05a243d0d3887379dfea51b3289aed68e (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 f33156065dd67520085f307ec90258e62a537571 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 4feb1f9..220b29d 100644
--- a/st.c
+++ b/st.c
@@ -4324,8 +4324,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.25.1