Flush main log (as well) before exit
[oweals/dinit.git] / src / dinit-log.cc
index 990ffefd38ee1085c2744585964c5b0a85cc646a..89c9f05a904ddde460a92e38c496b908454fc432 100644 (file)
@@ -1,4 +1,3 @@
-#include <iostream>
 #include <algorithm>
 
 #include <unistd.h>
@@ -282,7 +281,8 @@ void setup_main_log(int fd)
 
 bool is_log_flushed() noexcept
 {
-    return log_stream[DLOG_CONS].current_index == 0;
+    return log_stream[DLOG_CONS].current_index == 0 &&
+            (log_stream[DLOG_MAIN].fd == -1 || log_stream[DLOG_MAIN].current_index == 0);
 }
 
 // Enable or disable console logging. If disabled, console logging will be disabled on the