]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mbox: unconditionally add trailing newline
authorEric Wong <e@80x24.org>
Mon, 11 Apr 2016 04:51:40 +0000 (04:51 +0000)
committerEric Wong <e@80x24.org>
Mon, 11 Apr 2016 04:57:10 +0000 (04:57 +0000)
This may be necessary for compatibility with non-mboxrd aware
parsers which expect "\nFrom " for everything but the first
record.

lib/PublicInbox/Mbox.pm

index 0d67981f42a2e30e938f4ba3fa5ccf0f101f8087..9f20580e31f0ec6a888911e7056fdde30d2ede1d 100644 (file)
@@ -67,9 +67,7 @@ sub emit_msg {
        # ref: http://www.qmail.org/man/man5/mbox.html
        $buf =~ s/^(>*From )/>$1/gm;
 
-       $buf .= "\n" unless $buf =~ /\n\z/s;
-
-       $fh->write($buf);
+       $fh->write($buf .= "\n");
 }
 
 sub emit_mbox {