scroll

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

commit e96f0b9671d12a6977225ea22f7edf455331aa6e
parent 702a5592b8309cc3c91fc562fcfff0b4f58fb2f0
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Thu, 16 Apr 2020 22:03:04 +0200

ptty: error handling of close(2)

Diffstat:
Mptty.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ptty.c b/ptty.c @@ -112,7 +112,8 @@ main(int argc, char *argv[]) die("read:"); if (n == 0) { pfd[0].fd = -1; - close(mfd); + if (close(mfd) == -1) + die("close:"); break; } if (write(mfd, buf, n) == -1) @@ -129,7 +130,8 @@ main(int argc, char *argv[]) if (pfd[0].revents & POLLHUP) { pfd[0].fd = -1; - close(mfd); + if (close(mfd) == -1) + die("close:"); break; } if (pfd[1].revents & POLLHUP)