]> git.donarmstrong.com Git - debbugs.git/commitdiff
fix appending to log and use croak in a different place
authorDon Armstrong <don@donarmstrong.com>
Fri, 6 Aug 2010 06:32:03 +0000 (02:32 -0400)
committerDon Armstrong <don@donarmstrong.com>
Fri, 6 Aug 2010 06:32:03 +0000 (02:32 -0400)
Debbugs/Log.pm

index e64d2369a371b131466dd7f8d7fdf3e4aae4e73b..af80f7ab5e6f5d86b734bb27a6612f71e738ebf4 100644 (file)
@@ -368,7 +368,7 @@ sub write_log_records
         $logfh = $param{logfh}
     }
     elsif (exists $param{log_name}) {
-        $logfh = IO::File->new($param{log_name},'w') or
+        $logfh = IO::File->new(">>$param{log_name}") or
              die "Unable to open bug log $param{log_name} for writing: $!";
     }
     elsif (exists $param{bug_num}) {
@@ -381,8 +381,8 @@ sub write_log_records
 
     for my $record (@records) {
        my $type = $record->{type};
+       croak "record type '$type' with no text field" unless defined $record->{text};
        my ($text) = escape_log($record->{text});
-       croak "record type '$type' with no text field" unless defined $text;
        if ($type eq 'autocheck') {
            print {$logfh} "\01\n$text\03\n" or
                die "Unable to write to logfile: $!";