swaybar: fix errno handling in status_handle_readable

If getline fails once, it was not reset before the next getline
call. errno is only overwritten by getline on error.
This commit is contained in:
Simon Ser 2021-12-21 12:12:54 +01:00
parent 513fa00a5e
commit 414950bbc8
1 changed files with 1 additions and 1 deletions

View File

@ -117,11 +117,11 @@ bool status_handle_readable(struct status_line *status) {
status->text = status->buffer;
// intentional fall-through
case PROTOCOL_TEXT:
errno = 0;
while (true) {
if (status->buffer[read_bytes - 1] == '\n') {
status->buffer[read_bytes - 1] = '\0';
}
errno = 0;
read_bytes = getline(&status->buffer,
&status->buffer_size, status->read);
if (errno == EAGAIN) {