@@ -481,19 +481,13 @@ static int write_journald(int pipe, char *buf, ssize_t buflen)
481481 * The CRI requires us to write logs with a (timestamp, stream, line) format
482482 * for every newline-separated line. write_k8s_log writes said format for every
483483 * line in buf, and will partially write the final line of the log if buf is
484- * not terminated by a newline. A 0 buflen argument forces any buffered partial
485- * line to be finalized with an F-sequence.
484+ * not terminated by a newline.
486485 */
487486static int write_k8s_log (stdpipe_t pipe , const char * buf , ssize_t buflen )
488487{
489- static bool stdout_has_partial = false;
490- static bool stderr_has_partial = false;
491-
492488 writev_buffer_t bufv = {0 };
493489 int64_t bytes_to_be_written = 0 ;
494490
495- bool * has_partial = (pipe == STDOUT_PIPE ) ? & stdout_has_partial : & stderr_has_partial ;
496-
497491 /*
498492 * Use the same timestamp for every line of the log in this buffer.
499493 * There is no practical difference in the output since write(2) is
@@ -502,32 +496,6 @@ static int write_k8s_log(stdpipe_t pipe, const char *buf, ssize_t buflen)
502496 char tsbuf [TSBUFLEN ];
503497 set_k8s_timestamp (tsbuf , sizeof tsbuf , stdpipe_name (pipe ));
504498
505- /* If buflen is 0, this is a drain operation. Generate terminating F-sequence if needed. */
506- if (buflen == 0 && * has_partial ) {
507- /* Generate terminating F-sequence for previous partial line */
508- bool timestamp_written = false;
509- bool f_sequence_written = false;
510-
511- if (writev_buffer_append_segment (k8s_log_fd , & bufv , tsbuf , TSBUFLEN - 1 ) >= 0 ) {
512- timestamp_written = true;
513- if (writev_buffer_append_segment (k8s_log_fd , & bufv , "F\n" , 2 ) >= 0 ) {
514- f_sequence_written = true;
515- }
516- }
517-
518- if (timestamp_written && f_sequence_written ) {
519- k8s_bytes_written += TSBUFLEN - 1 + 2 ;
520- k8s_total_bytes_written += TSBUFLEN - 1 + 2 ;
521- } else {
522- if (!timestamp_written ) {
523- nwarn ("failed to write timestamp for terminating F-sequence" );
524- } else {
525- nwarn ("failed to write terminating F-sequence" );
526- }
527- }
528- * has_partial = false;
529- }
530-
531499 ptrdiff_t line_len = 0 ;
532500 while (buflen > 0 ) {
533501 bool partial = get_line_len (& line_len , buf , buflen );
@@ -591,9 +559,6 @@ static int write_k8s_log(stdpipe_t pipe, const char *buf, ssize_t buflen)
591559
592560 k8s_bytes_written += bytes_to_be_written ;
593561 k8s_total_bytes_written += bytes_to_be_written ;
594-
595- /* Track partial state for this pipe */
596- * has_partial = partial ;
597562 next :
598563 /* Update the head of the buffer remaining to output. */
599564 buf += line_len ;
0 commit comments