]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/IMAPTracker.pm
rewrite Linux nodatacow use in pure Perl w/o system
[public-inbox.git] / lib / PublicInbox / IMAPTracker.pm
index 5eb33cf752f438ee1f352f1442c58bf9ab00baba..4efa8a7e7e38b774ee09709b1de027d7c4cd8b79 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 package PublicInbox::IMAPTracker;
 use strict;
@@ -75,11 +75,11 @@ sub new {
        }
        if (!-f $dbname) {
                require File::Path;
-               require File::Basename;
-               require PublicInbox::Spawn;
-               File::Path::mkpath(File::Basename::dirname($dbname));
+               require PublicInbox::Syscall;
+               my ($dir) = ($dbname =~ m!(.*?/)[^/]+\z!);
+               File::Path::mkpath($dir);
+               PublicInbox::Syscall::nodatacow_dir($dir);
                open my $fh, '+>>', $dbname or die "failed to open $dbname: $!";
-               PublicInbox::Spawn::nodatacow_fd(fileno($fh));
        }
        my $self = bless { lock_path => "$dbname.lock", url => $url }, $class;
        $self->lock_acquire;