X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FV2Writable.pm;h=d8d75ec272d809335f91a82ce8b10e5fc1be5516;hb=2a353273079b2491cbceb20526d3c9dbf43d8f62;hp=1316d628491f576c0096b3be215826d94e03aae9;hpb=8b4ddc9c2c08cd085f5c4d5dfc019342dd53b570;p=public-inbox.git diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 1316d628..d8d75ec2 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -63,6 +63,7 @@ sub new { } $v2ibx = PublicInbox::InboxWritable->new($v2ibx); + $v2ibx->umask_prepare; my $xpfx = "$dir/xap" . PublicInbox::Search::SCHEMA_VERSION; my $self = { @@ -95,6 +96,13 @@ sub init_inbox { # mimics Import::add and wraps it for v2 sub add { my ($self, $mime, $check_cb) = @_; + $self->{-inbox}->with_umask(sub { + _add($self, $mime, $check_cb) + }); +} + +sub _add { + my ($self, $mime, $check_cb) = @_; # spam check: if ($check_cb) { @@ -348,12 +356,16 @@ sub remove_internal { sub remove { my ($self, $mime, $cmt_msg) = @_; - remove_internal($self, $mime, $cmt_msg); + $self->{-inbox}->with_umask(sub { + remove_internal($self, $mime, $cmt_msg); + }); } sub purge { my ($self, $mime) = @_; - my $purges = remove_internal($self, $mime, undef, {}); + my $purges = $self->{-inbox}->with_umask(sub { + remove_internal($self, $mime, undef, {}); + }); $self->idx_init if @$purges; # ->done is called on purges for my $i (0..$#$purges) { defined(my $cmt = $purges->[$i]) or next;