]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/child.c
i3bar: add modelines to all files
[i3/i3] / i3bar / src / child.c
index a8de6fb91164718f2da4a17ff6f1e72eac99ed03..ff1bc8bb63922c94e14378767c92024969a78fc6 100644 (file)
@@ -1,7 +1,9 @@
 /*
+ * vim:ts=4:sw=4:expandtab
+ *
  * i3bar - an xcb-based status- and ws-bar for i3
  *
- * © 2010 Axel Wagner and contributors
+ * © 2010-2011 Axel Wagner and contributors
  *
  * See file LICNSE for license information
  *
@@ -40,12 +42,13 @@ 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) {
         ev_child_stop(main_loop, child_sig);
         FREE(child_sig);
-        FREE(statusline_buffer);
     }
 }
 
@@ -79,17 +82,17 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
             }
 
             /* end of file, kill the watcher */
-            DLOG("stdin: EOF\n");
-            ev_io_stop(loop, watcher);
-            FREE(stdin_io);
-            break;
+            ELOG("stdin: received EOF\n");
+            cleanup();
+            draw_bars();
+            return;
         }
         rec += n;
 
         if (rec == buffer_len) {
             buffer_len += STDIN_CHUNK_SIZE;
             buffer = realloc(buffer, buffer_len);
-           }
+        }
     }
     if (*buffer == '\0') {
         FREE(buffer);
@@ -112,7 +115,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();