aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2021-12-21 12:12:54 +0100
committerLibravatar Simon Ser <contact@emersion.fr>2021-12-23 12:16:37 +0100
commit5d16d15a95bfaa1d55255b108e4c86337b8900b5 (patch)
tree9d26ec4e58d9c6fe38ceaac08e05b9dc6d0310f2
parentoutput: emit node::destroy event (diff)
downloadsway-5d16d15a95bfaa1d55255b108e4c86337b8900b5.tar.gz
sway-5d16d15a95bfaa1d55255b108e4c86337b8900b5.tar.zst
sway-5d16d15a95bfaa1d55255b108e4c86337b8900b5.zip
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 414950bbc8e833362a689cc11720855e8edd1323)
-rw-r--r--swaybar/status_line.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
index a97f3525..2e9bb7f1 100644
--- a/swaybar/status_line.c
+++ b/swaybar/status_line.c
@@ -117,11 +117,11 @@ bool status_handle_readable(struct status_line *status) {
117 status->text = status->buffer; 117 status->text = status->buffer;
118 // intentional fall-through 118 // intentional fall-through
119 case PROTOCOL_TEXT: 119 case PROTOCOL_TEXT:
120 errno = 0;
121 while (true) { 120 while (true) {
122 if (status->buffer[read_bytes - 1] == '\n') { 121 if (status->buffer[read_bytes - 1] == '\n') {
123 status->buffer[read_bytes - 1] = '\0'; 122 status->buffer[read_bytes - 1] = '\0';
124 } 123 }
124 errno = 0;
125 read_bytes = getline(&status->buffer, 125 read_bytes = getline(&status->buffer,
126 &status->buffer_size, status->read); 126 &status->buffer_size, status->read);
127 if (errno == EAGAIN) { 127 if (errno == EAGAIN) {