From 90df6338354b621828f2fae257380d766406b4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 5 Jul 2017 22:10:12 +0200 Subject: text: limit write(2) calls to INT_MAX bytes Otherwise this fails on macOS. Fix #578 --- text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text.c b/text.c index 4c7fdc2..caf203b 100644 --- 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; -- cgit v1.2.3