conmon: flush the iov buffer before reopening the log file
There might be data left from a previous flush happening in the middle
of a log line, thus causing the first line in the new log file to be
incomplete.
@@ -399,6 +399,9 @@ static int write_k8s_log(int fd, stdpipe_t pipe, const char *buf, ssize_t buflen
if ((opt_log_size_max > 0) && (bytes_written + bytes_to_be_written) > opt_log_size_max) {
bytes_written = 0;
+ if (writev_buffer_flush(fd, &bufv) < 0) {
+ nwarn("failed to flush buffer to log");
+ }
reopen_log_file();
/* Reassign to the new log file fd */
