Simplify tty_flush()

This commit is contained in:
Martin Lund 2022-07-20 20:46:01 +02:00
parent 5f46136b28
commit 6462aac792

View file

@ -154,7 +154,7 @@ void tty_flush(int fd)
{ {
ssize_t count; ssize_t count;
do while (tty_buffer_count > 0)
{ {
count = write(fd, tty_buffer, tty_buffer_count); count = write(fd, tty_buffer, tty_buffer_count);
if (count < 0) if (count < 0)
@ -165,11 +165,11 @@ void tty_flush(int fd)
} }
tty_buffer_count -= count; tty_buffer_count -= count;
} }
while (tty_buffer_count > 0);
// Reset // Reset
tty_buffer_write_ptr = tty_buffer; tty_buffer_write_ptr = tty_buffer;
tty_buffer_count = 0; tty_buffer_count = 0;
fsync(fd);
} }
ssize_t tty_write(int fd, const void *buffer, size_t count) ssize_t tty_write(int fd, const void *buffer, size_t count)