scroll

scrollbackbuffer program for st
git clone git://git.suckless.org/scroll
Log | Files | Refs | README

commit 1dbf2dce08892df710645ddbd2ce12759ec95078
parent 58c58743d8f391ef0e4776fc46d92c824795d162
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Thu, 30 Apr 2020 22:12:50 +0200

fix race condition between sigwinch and sigchld

sigwinch died if it tries to set the window size
to a file descriptor of an exited child.  Thus,
we just ignore this error in that situation.

Diffstat:
Mscroll.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scroll.c b/scroll.c @@ -96,8 +96,11 @@ sigwinch(int sig) if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1) die("ioctl:"); - if (ioctl(mfd, TIOCSWINSZ, &ws) == -1) + if (ioctl(mfd, TIOCSWINSZ, &ws) == -1) { + if (errno == EBADF) /* child already exited */ + return; die("ioctl:"); + } kill(-child, SIGWINCH); doredraw = true; }