commit: f1ad243a046bd5e4dbbb94a41a6347e982911970
parent db048e289141fa36fa38755d8bb2cf3ea8fa3747
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 29 Mar 2021 19:25:55 -0700
st: Fix SIGCHLD handler in plumb patch
When I applied the plumb patch, I altered it slightly so that st
didn't block on the plumb command returning, but messed up the
condition in the SIGCHLD handler wait loop.
Diffstat:
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/pkg/st/patch/0003-Add-support-for-plumbing-via-right-click.patch b/pkg/st/patch/0003-Add-support-for-plumbing-via-right-click.patch
@@ -1,12 +1,12 @@
-From 278e0375c56b7a8abca4807163158e6811b01125 Mon Sep 17 00:00:00 2001
+From ff54d8fda487f9e73ec895f86639a57d749e5048 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Wed, 2 Dec 2020 17:54:35 -0800
Subject: [PATCH] Add support for plumbing via right click
---
config.def.h | 5 ++++
- st.c | 74 +++++++++++++++++++++++++++++++++++++++++++---------
- 2 files changed, 67 insertions(+), 12 deletions(-)
+ st.c | 79 ++++++++++++++++++++++++++++++++++++++++++++--------
+ 2 files changed, 72 insertions(+), 12 deletions(-)
diff --git a/config.def.h b/config.def.h
index 49ca50b..a63d2be 100644
@@ -22,7 +22,7 @@ index 49ca50b..a63d2be 100644
+ */
+static char *plumb_cmd[] = {"plumb", NULL, NULL};
diff --git a/st.c b/st.c
-index caa5aa0..e27ee51 100644
+index caa5aa0..02d5397 100644
--- a/st.c
+++ b/st.c
@@ -44,6 +44,9 @@ char *argv0;
@@ -104,7 +104,7 @@ index caa5aa0..e27ee51 100644
void
die(const char *errstr, ...)
{
-@@ -1227,15 +1271,13 @@ sigchld(int a)
+@@ -1227,15 +1271,18 @@ sigchld(int a)
int stat;
pid_t p;
@@ -117,7 +117,12 @@ index caa5aa0..e27ee51 100644
- if (!WIFEXITED(stat) || WEXITSTATUS(stat))
- die("child finished with error '%d'\n", stat);
- exit(0);
-+ while ((p = waitpid(-1, &stat, WNOHANG)) == 0) {
++ for (;;) {
++ p = waitpid(-1, &stat, WNOHANG);
++ if (p == 0)
++ break;
++ if (p < 0)
++ die("waitpid: %s\n", strerror(errno));
+ if (pid == p) {
+ if (!WIFEXITED(stat) || WEXITSTATUS(stat))
+ die("child finished with error '%d'\n", stat);
@@ -127,7 +132,7 @@ index caa5aa0..e27ee51 100644
}
-@@ -4223,16 +4265,23 @@ ptrbutton(void * data, struct wl_pointer * pointer, uint32_t serial,
+@@ -4223,16 +4270,23 @@ ptrbutton(void * data, struct wl_pointer * pointer, uint32_t serial,
switch (state) {
case WL_POINTER_BUTTON_STATE_RELEASED:
@@ -154,7 +159,7 @@ index caa5aa0..e27ee51 100644
}
break;
-@@ -4556,6 +4605,7 @@ main(int argc, char *argv[])
+@@ -4556,6 +4610,7 @@ main(int argc, char *argv[])
} ARGEND;
run:
@@ -163,5 +168,5 @@ index caa5aa0..e27ee51 100644
/* eat all remaining arguments */
opt_cmd = argv;
--
-2.29.2
+2.30.1
diff --git a/pkg/st/ver b/pkg/st/ver
@@ -1 +1 @@
-c63a87cd93 r4
+c63a87cd93 r5