Introduction
Introduction Statistics Contact Development Disclaimer Help
avoid race condition with sigwinch - scroll - scrollbackbuffer program for st
git clone git://git.suckless.org/scroll
Log
Files
Refs
README
LICENSE
---
commit 6d1a3bbbb870a303b47f790ba76146e61a4c7b6a
parent 6b13c34098454e6e667aca6bf37c47feedc0d185
Author: Jan Klemkow <[email protected]>
Date: Tue, 28 Apr 2020 21:20:42 +0200
avoid race condition with sigwinch
if sigwinch comes before forking the child process,
we are traped into an endless loop. because, the
variable child is zero. Thus, we propagating sigwinch
to ourself in the signal handler.
Diffstat:
M scroll.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/scroll.c b/scroll.c
@@ -428,9 +428,6 @@ main(int argc, char *argv[])
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1)
die("ioctl:");
- if (signal(SIGWINCH, sigwinch) == SIG_ERR)
- die("signal:");
-
child = forkpty(&mfd, NULL, &dfl, &ws);
if (child == -1)
die("forkpty:");
@@ -457,6 +454,9 @@ main(int argc, char *argv[])
die("pledge:");
#endif
+ if (signal(SIGWINCH, sigwinch) == SIG_ERR)
+ die("signal:");
+
struct termios new = dfl;
cfmakeraw(&new);
new.c_cc[VMIN ] = 1; /* return read if at least one byte in buf…
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.