commit 414950bbc8e833362a689cc11720855e8edd1323
parent 513fa00a5ecf91a59f96f0ce8dfad846aa81547e
Author: Simon Ser <contact@emersion.fr>
Date: Tue, 21 Dec 2021 12:12:54 +0100
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
@@ -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) {