commit 270695a375c6af6579a26ccc62cef0be2b98a3e0 from: Omar Polo date: Tue Aug 30 10:25:46 2022 UTC use File::Temp for the index pages; specify why it's not using tmppath we can't use the tmppath pledge promise as File::Temp checks whether /tmp exists. We could unveil("/tmp", "r") and use `tmppath', but it seem misleading. (noticed after semarie@ reminded me of `tmppath') commit - d3d07147e45c1d13f2879130149ab354574e0f32 commit + 270695a375c6af6579a26ccc62cef0be2b98a3e0 blob - c4a737f62a074b753ace5130fde82a16f29cffaf blob + 1cdf9604017edb0e7c5ffaae40eac7402c2975d6 --- mkindex +++ mkindex @@ -9,6 +9,7 @@ use utf8; use strict; use warnings; use v5.32; +use File::Temp qw(tempfile); use OpenBSD::Pledge; use OpenBSD::Unveil; @@ -23,6 +24,7 @@ my $tfh; # thread file handle my $pfh; # page file handle my $page = 0; my @pages; +my @files; my $from_day; my $to_day; my $threads_seen = 0; @@ -56,11 +58,10 @@ sub endfile { sub nextfile { endfile if defined $pfh; $page += 1; - my $path = pagename($page); - # XXX: mkstemp would be better... - open($pfh, '>', "/tmp/$path") - or die "can't open $path: $!"; + my $path; + ($pfh, $path) = tempfile "/tmp/gotmarc.index.XXXXXXXXXX"; + push @files, $path; say $pfh "