scroll

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

commit 5497edaec0dbb2b49ba643e834c0de336b56a603
parent da549bbe4627628c229b9b3e77448aa3bae04bd2
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Thu, 16 Apr 2020 20:59:41 +0200

ptty: better error handling

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

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