From 9c587a767c78d0ec166b5e8674c5d3be42df4d98 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 25 Aug 2011 17:10:45 +0200 Subject: [PATCH 1/2] Bugfix: set statusline = NULL, print error messages about EOF/SIGCHLD to stderr (Thanks cls) --- i3bar/src/child.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/i3bar/src/child.c b/i3bar/src/child.c index 3f59d060..1662dbd2 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -40,6 +40,8 @@ void cleanup() { ev_io_stop(main_loop, stdin_io); FREE(stdin_io); FREE(statusline_buffer); + /* statusline pointed to memory within statusline_buffer */ + statusline = NULL; } if (child_sig != NULL) { @@ -78,7 +80,7 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { } /* end of file, kill the watcher */ - DLOG("stdin: EOF\n"); + ELOG("stdin: received EOF\n"); cleanup(); break; } @@ -110,7 +112,7 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { * */ void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) { - DLOG("Child (pid: %d) unexpectedly exited with status %d\n", + ELOG("Child (pid: %d) unexpectedly exited with status %d\n", child_pid, watcher->rstatus); cleanup(); From 39cff5c31f4cdc7bc8496d1f1930e0b1aba7c929 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 25 Aug 2011 18:46:08 +0200 Subject: [PATCH 2/2] i3bar: Bugfix: When receiving EOF, immediately redraw and discard input --- i3bar/src/child.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/i3bar/src/child.c b/i3bar/src/child.c index 1662dbd2..faab9142 100644 --- a/i3bar/src/child.c +++ b/i3bar/src/child.c @@ -82,7 +82,8 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { /* end of file, kill the watcher */ ELOG("stdin: received EOF\n"); cleanup(); - break; + draw_bars(); + return; } rec += n;