From a6408fc242592ab7985047345b18892eee3e383d Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 18 Jan 2018 15:43:13 -0500 Subject: [PATCH] in high sierra, estimated read size always seems to be 0. handle that situation. --- TermWindowController.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TermWindowController.mm b/TermWindowController.mm index 701e16b..e523de8 100644 --- a/TermWindowController.mm +++ b/TermWindowController.mm @@ -236,7 +236,7 @@ static uint8_t sbuffer[1024]; size_t estimated = dispatch_source_get_data(_read_source); - + estimated = std::max(estimated, sizeof(sbuffer)); uint8_t *buffer = estimated > sizeof(sbuffer) ? (uint8_t *)malloc(estimated) : sbuffer; if (buffer) @@ -244,7 +244,7 @@ ssize_t actual; for (;;) { - actual = read(fd, buffer, (estimated)); + actual = read(fd, buffer, estimated); if (actual < 0) { if (errno == EINTR) continue;