]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Over.pm
ensure SQLite and Xapian files respect core.sharedRepository
[public-inbox.git] / lib / PublicInbox / Over.pm
index 07e54b64ca5de9448a4cf35399faaa37d7e6295a..30f2603f7d2a4324d02c1900593c4a80253ba790 100644 (file)
@@ -15,7 +15,11 @@ use Compress::Zlib qw(uncompress);
 sub dbh_new {
        my ($self) = @_;
        my $ro = ref($self) eq 'PublicInbox::Over';
-       my $dbh = DBI->connect("dbi:SQLite:dbname=$self->{filename}",'','', {
+       my $f = $self->{filename};
+       if (!$ro && !-f $f) { # SQLite defaults mode to 0644, we want 0666
+               open my $fh, '+>>', $f or die "failed to open $f: $!";
+       }
+       my $dbh = DBI->connect("dbi:SQLite:dbname=$f",'','', {
                AutoCommit => 1,
                RaiseError => 1,
                PrintError => 0,