* [PATCH] tmpfile: modernize to 5.10.1+, note O_APPEND workaround
@ 2020-10-16 7:05 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-10-16 7:05 UTC (permalink / raw)
To: meta
Once again we'll need O_APPEND on a temporary file, so note we
support it, here; since Perl 5.32 is way too new to depend on
our users having.
---
Just something I noticed while working on other stuff, since
I'll be relying on O_APPEND tmpfile behavior in yet another place.
lib/PublicInbox/Tmpfile.pm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/Tmpfile.pm b/lib/PublicInbox/Tmpfile.pm
index 25bb3a52..eb0fce00 100644
--- a/lib/PublicInbox/Tmpfile.pm
+++ b/lib/PublicInbox/Tmpfile.pm
@@ -2,8 +2,8 @@
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
package PublicInbox::Tmpfile;
use strict;
-use warnings;
-use base qw(Exporter);
+use v5.10.1;
+use parent qw(Exporter);
our @EXPORT = qw(tmpfile);
use Fcntl qw(:DEFAULT);
use Errno qw(EEXIST);
@@ -13,6 +13,9 @@ use File::Spec;
# unlinked filename which makes sense when viewed with lsof
# (at least on Linux)
# And if we ever stop caring to have debuggable filenames, O_TMPFILE :)
+#
+# This is also for Perl <5.32 which lacks: open(..., '+>>', undef)
+# <https://rt.perl.org/Ticket/Display.html?id=134221>
sub tmpfile ($;$$) {
my ($id, $sock, $append) = @_;
if (defined $sock) {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-16 7:05 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 7:05 [PATCH] tmpfile: modernize to 5.10.1+, note O_APPEND workaround Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).