From 3be3d4a5880102009b74d86292f36ea51a0af1af Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 2 Apr 2021 14:01:25 -0400 Subject: [PATCH] Always send null byte out stdout If the buffer doesn't exist or if it does, either way make sure to write out a null byte to let the caller know that it is done. --- confluent_vtbufferd/vtbufferd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/confluent_vtbufferd/vtbufferd.c b/confluent_vtbufferd/vtbufferd.c index a77e2be1..14c5a42b 100644 --- a/confluent_vtbufferd/vtbufferd.c +++ b/confluent_vtbufferd/vtbufferd.c @@ -158,10 +158,6 @@ void dump_vt(TMT* outvt) { fflush(stdout); wprintf(L"\x1b[%ld;%ldH", curs->r + 1, curs->c + 1); fflush(stdout); - idx = write(1, "\x00", 1); - if (idx < 0) { - return; - } } int main(int argc, char* argv[]) { @@ -201,9 +197,11 @@ int main(int argc, char* argv[]) { if (cmd < 0) continue; outvt = get_termentbyname(cmdbuf); - if (outvt != NULL) { + if (outvt != NULL) dump_vt(outvt); - } + idx = write(1, "\x00", 1); + if (idx < 0) + continue; } } }