vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit fece993997442bc4d0b85a3337719532e98785dc parent 68d02a0e85ee7f3fbc75afd0d88746a5b545740f Author: Marc André Tanner <mat@brain-dump.org> Date: Wed, 8 Feb 2017 19:35:31 +0100 vis-menu: check read(2) return value Fixes CID 137371 Diffstat:
| M | vis-menu.c | | | 3 | ++- |
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/vis-menu.c b/vis-menu.c @@ -308,7 +308,8 @@ readstdin() { static void xread(int fd, void *buf, size_t nbyte) { - if (read(fd, buf, nbyte) < 0) + ssize_t r = read(fd, buf, nbyte); + if (r < 0 || (size_t)r != nbyte) die("Can not read."); }