From 74735c39a1c764bc11d4c870884df00aff091f75 Mon Sep 17 00:00:00 2001 From: Darold Gilles Date: Thu, 20 Jun 2013 19:24:33 +0200 Subject: [PATCH] Remove creation of incremental temporary file $tmp_last_parsed when we are not in multiprocess mode. Thanks to Herve Werner for the report. --- pgbadger | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pgbadger b/pgbadger index 45cd66d..b5fee24 100755 --- a/pgbadger +++ b/pgbadger @@ -1464,13 +1464,15 @@ sub process_file } # Save last line into temporary file - if ($last_parsed && scalar keys %last_line) { - if (open(OUT, ">>$tmp_last_parsed")) { - flock(OUT, 2) || return $getout; - print OUT "$last_line{datetime}\t$last_line{orig}\n"; - close(OUT); - } else { - &logmsg('ERROR', "can't save last parsed line into $last_parsed, $!"); + if ( ($queue_size > 1) || ($job_per_file > 1) ) { + if ($last_parsed && scalar keys %last_line) { + if (open(OUT, ">>$tmp_last_parsed")) { + flock(OUT, 2) || return $getout; + print OUT "$last_line{datetime}\t$last_line{orig}\n"; + close(OUT); + } else { + &logmsg('ERROR', "can't save last parsed line into $tmp_last_parsed, $!"); + } } } -- 2.40.0