* [PATCH] tmpfile: modernize to 5.10.1+, note O_APPEND workaround
@ 2020-10-16 7:05 7% Eric Wong
0 siblings, 0 replies; 1+ results
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 [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-10-16 7:05 7% [PATCH] tmpfile: modernize to 5.10.1+, note O_APPEND workaround Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).