X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;ds=sidebyside;f=st.c;h=300cab631d76ead7242c23e3a0b06162427bd19c;hb=07ce96a3a0f4a650933f5f586082cbf2064ea2c1;hp=6c167b5d7c46b78e3b696b955b6bde833196f1c2;hpb=4f21c41a1c19f769a2bf7941ee18fa0606266cca;p=st.git diff --git a/st.c b/st.c index 6c167b5..300cab6 100644 --- a/st.c +++ b/st.c @@ -860,7 +860,6 @@ mousereport(XEvent *e) { + ((state & ControlMask) ? 16 : 0); } - len = 0; if(IS_SET(MODE_MOUSESGR)) { len = snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c", button, x+1, y+1, @@ -1239,10 +1238,14 @@ execsh(void) { void sigchld(int a) { int stat, ret; + pid_t p; - if(waitpid(pid, &stat, 0) < 0) + if((p = waitpid(pid, &stat, WNOHANG)) < 0) die("Waiting for pid %hd failed: %s\n", pid, strerror(errno)); + if(pid != p) + return; + ret = WIFEXITED(stat) ? WEXITSTATUS(stat) : EXIT_FAILURE; if (ret != EXIT_SUCCESS) die("child finished with error '%d'\n", stat);