scroll

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

commit 6612bc96e47e1db1199a4d1b657dd10eb4cd438e
parent 47f9a83aaf2304291c6b7b8812747f482f609902
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Mon, 20 Apr 2020 23:01:21 +0200

check explicit for return of -1

Diffstat:
Mscroll.c | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scroll.c b/scroll.c @@ -223,11 +223,11 @@ getcursorposition(int *x, int *y) char input[BUFSIZ]; ssize_t n; - if (write(STDOUT_FILENO, "\033[6n", 4) < 0) + if (write(STDOUT_FILENO, "\033[6n", 4) == -1) die("requesting cursor position"); do { - if ((n = read(STDIN_FILENO, input, sizeof(input)-1)) < 0) + if ((n = read(STDIN_FILENO, input, sizeof(input)-1)) == -1) die("reading cursor position"); input[n] = '\0'; } while (sscanf(input, "\033[%d;%dR", x, y) != 2); @@ -415,7 +415,7 @@ main(int argc, char *argv[]) die("atexit:"); /* get window size of the terminal */ - if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0) + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) == -1) die("ioctl:"); if (signal(SIGWINCH, sigwinch) == SIG_ERR)