From 9c587a767c78d0ec166b5e8674c5d3be42df4d98 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Thu, 25 Aug 2011 17:10:45 +0200
Subject: [PATCH] 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();