vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit bfedea03f95c9739818d92573002611b39cf35c7
parent 8dfe6b587b007cbed7bcc5d7c4760e5fd3712598
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed,  5 Jul 2017 22:10:12 +0200

text: limit write(2) calls to INT_MAX bytes

Otherwise this fails on macOS.

Fix #578

Diffstat:
Mtext.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/text.c b/text.c @@ -175,7 +175,7 @@ static size_t lines_count(Text *txt, size_t pos, size_t len); static ssize_t write_all(int fd, const char *buf, size_t count) { size_t rem = count; while (rem > 0) { - ssize_t written = write(fd, buf, rem); + ssize_t written = write(fd, buf, rem > INT_MAX ? INT_MAX : rem); if (written < 0) { if (errno == EAGAIN || errno == EINTR) continue;