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