mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2025-02-01 12:30:16 +00:00
in high sierra, estimated read size always seems to be 0. handle that situation.
This commit is contained in:
parent
de8810b8e2
commit
a6408fc242
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user