externalpipe: sigchld changes interfere with right-click-to-plumb and opencopied patches, proposed fix ref. #27

This commit is contained in:
bakkeby 2021-05-15 11:44:09 +02:00
parent 56931acefb
commit 80bb4b8ab7
3 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,5 @@
int extpipeactive = 0;
void
#if EXTERNALPIPEIN_PATCH
extpipe(const Arg *arg, int in)
@ -58,6 +60,7 @@ externalpipe(const Arg *arg)
close(to[1]);
/* restore */
signal(SIGPIPE, oldsigpipe);
extpipeactive = 1;
}
#if EXTERNALPIPEIN_PATCH

6
st.c
View File

@ -977,7 +977,7 @@ sigchld(int a)
pid_t p;
#if EXTERNALPIPEIN_PATCH && EXTERNALPIPE_PATCH
if ((p = waitpid(-1, &stat, WNOHANG)) < 0)
if ((p = waitpid((extpipeactive ? -1 : pid), &stat, WNOHANG)) < 0)
#else
if ((p = waitpid(pid, &stat, WNOHANG)) < 0)
#endif // EXTERNALPIPEIN_PATCH
@ -985,11 +985,15 @@ sigchld(int a)
#if EXTERNALPIPE_PATCH
if (pid != p) {
if (!extpipeactive)
return;
if (p == 0 && wait(&stat) < 0)
die("wait: %s\n", strerror(errno));
/* reinstall sigchld handler */
signal(SIGCHLD, sigchld);
extpipeactive = 0;
return;
}
#else

4
st.h
View File

@ -345,6 +345,10 @@ extern unsigned int tabspaces;
extern unsigned int defaultfg;
extern unsigned int defaultbg;
extern unsigned int defaultcs;
#if EXTERNALPIPE_PATCH
extern int extpipeactive;
#endif // EXTERNALPIPE_PATCH
#if BOXDRAW_PATCH
extern const int boxdraw, boxdraw_bold, boxdraw_braille;
#endif // BOXDRAW_PATCH