diff options
author | Ryan Dwyer <RyanDwyer@users.noreply.github.com> | 2018-09-22 20:10:58 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-22 20:10:58 +1000 |
commit | 480bcda1ee244af49fd826a58fb5ad3fba86444a (patch) | |
tree | 9fe3ee50c17a53266183e1e4643bb149c6af6c86 | |
parent | b148da848ae9075822cd8ddd743532f3ce78f923 (diff) | |
parent | a4d346627cc661f32bc7fb65a43ff19d48b50a96 (diff) | |
download | sway-480bcda1ee244af49fd826a58fb5ad3fba86444a.tar.xz |
Merge pull request #2687 from ianyfan/swaybar
swaybar: explicitly check return value of getdelim
-rw-r--r-- | swaybar/status_line.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/swaybar/status_line.c b/swaybar/status_line.c index 401bf6f6..48b43248 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c @@ -67,9 +67,13 @@ bool status_handle_readable(struct status_line *status) { wl_list_init(&status->blocks); status->tokener = json_tokener_new(); - status->buffer_index = getdelim(&status->buffer, - &status->buffer_size, EOF, status->read); - return i3bar_handle_readable(status); + read_bytes = getdelim(&status->buffer, &status->buffer_size, EOF, status->read); + if (read_bytes > 0) { + status->buffer_index = read_bytes; + return i3bar_handle_readable(status); + } else { + return false; + } } wlr_log(WLR_DEBUG, "Using text protocol."); |