]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei: use ->child_error API properly
authorEric Wong <e@80x24.org>
Sat, 16 Dec 2023 11:13:16 +0000 (11:13 +0000)
committerEric Wong <e@80x24.org>
Sat, 16 Dec 2023 13:06:34 +0000 (13:06 +0000)
I noticed this bug while developing another feature and tests
were getting SIGHUP (since SIGHUP == 1 on most systems).

lib/PublicInbox/LeiExportKw.pm
lib/PublicInbox/LeiMirror.pm
lib/PublicInbox/LeiToMail.pm

index d2396fa7d697bb7b8b9ddf092ff27de65230f350..16f069da940b3305176320b46a07ba4ef351a5e1 100644 (file)
@@ -38,7 +38,7 @@ sub export_kw_md { # LeiMailSync->each_src callback
                } elsif ($! == EEXIST) { # lost race with lei/store?
                        return;
                } elsif ($! != ENOENT) {
-                       $lei->child_error(1,
+                       $lei->child_error(0,
                                "E: rename_noreplace($src -> $dst): $!");
                } # else loop @try
        }
@@ -46,7 +46,7 @@ sub export_kw_md { # LeiMailSync->each_src callback
        # both tries failed
        my $oidhex = unpack('H*', $oidbin);
        my $src = "$mdir/{".join(',', @try)."}/$$id";
-       $lei->child_error(1, "rename_noreplace($src -> $dst) ($oidhex): $e");
+       $lei->child_error(0, "rename_noreplace($src -> $dst) ($oidhex): $e");
        for (@try) { return if -e "$mdir/$_/$$id" }
        $self->{lms}->clear_src("maildir:$mdir", $id);
 }
index 0c77a8b5f0f347ebe481dfc706ffba58c86c3a01..5353ae61c40249d65a7cdffc4b9862681f1fa8cd 100644 (file)
@@ -1175,7 +1175,7 @@ sub try_manifest {
        local $self->{-local_manifest} = load_current_manifest($self);
        local $self->{-new_symlinks} = [];
        my ($path_pfx, $n, $multi) = multi_inbox($self, \$path, $m);
-       return $lei->child_error(1, $multi) if !ref($multi);
+       return $lei->child_error(0, $multi) if !ref($multi);
        my $v2 = delete $multi->{v2};
        if ($v2) {
                for my $name (sort keys %$v2) {
index a930fc30b512f7ce93abe08869b7fc365906ccde..071ba11384784c63b633a46ad6414af5660d8ffa 100644 (file)
@@ -147,9 +147,9 @@ sub git_to_mail { # git->cat_async callback
                        $type = 'blob';
                        $size = length($$bref);
                }
-               $type eq 'blob' or return $self->{lei}->child_error(1,
+               $type eq 'blob' or return $self->{lei}->child_error(0,
                                                "W: $oid is $type (!= blob)");
-               $size or return $self->{lei}->child_error(1,"E: $oid is empty");
+               $size or return $self->{lei}->child_error(0,"E: $oid is empty");
                $smsg->{blob} eq $oid or die "BUG: expected=$smsg->{blob}";
                $self->{wcb}->($bref, $smsg);
        };