mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 12:33:50 +01:00
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.
(cherry picked from commit 414950bbc8
)
This commit is contained in:
parent
9ecbfe3665
commit
5d16d15a95
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user