diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-07-05 22:10:12 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-07-05 22:10:12 +0200 |
| commit | 90df6338354b621828f2fae257380d766406b4a4 (patch) | |
| tree | ce9ae27a251b7fa76a61d36f6f0cd4c21e8accc0 | |
| parent | d6c4d8b155de16abcfcffa2a9bbfa886909b3ec3 (diff) | |
| download | vis-90df6338354b621828f2fae257380d766406b4a4.tar.gz vis-90df6338354b621828f2fae257380d766406b4a4.tar.xz | |
text: limit write(2) calls to INT_MAX bytes
Otherwise this fails on macOS.
Fix #578
| -rw-r--r-- | text.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |
