From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9DE801F406 for ; Sun, 29 Oct 2023 05:56:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698558992; bh=yBQkWNNE8qndVd6z0FgI1d8EpGPcWIf1SFWUCc0STB8=; h=From:To:Subject:Date:From; b=poU90ZPYQqmSGw3v8Es1oVjJu7WH1okQxFXvQRpRbrlXNGJjcVuZnYBC2Cfh9j/6+ XAYd0TwJ4G8uW1XIXmrozLFcme6BD3aaWpu6KcpDx10/S8180l1UaANKQ01gAZAk11 rEtXztOsZ1TDwwvyHJlbjAziTMhRxWlDr6QaUJs4= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] lei_mirror: fix seek/sysseek argument ordering Date: Sun, 29 Oct 2023 05:56:32 +0000 Message-Id: <20231029055632.1538737-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It doesn't matter in practice for platforms we support, since SEEK_SET is `0' everywhere I've seen. --- lib/PublicInbox/LeiMirror.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index c2f7cbed..0f378768 100644 --- a/lib/PublicInbox/LeiMirror.pm +++ b/lib/PublicInbox/LeiMirror.pm @@ -171,7 +171,7 @@ sub _get_txt_done { # returns true on error (non-fatal), undef on success $? = 0; # don't influence normal lei exit return warn("$uri missing\n") if ($cerr >> 8) == 22; return warn("# @$cmd failed (non-fatal)\n") if $cerr; - seek($fh, SEEK_SET, 0); + seek($fh, 0, SEEK_SET); $self->{"mtime.$endpoint"} = (stat($fh))[9]; $self->{"txt.$endpoint"} = read_all($fh, -s _); undef; # success @@ -305,8 +305,8 @@ sub fgrp_update { return if !keep_going($fgrp); my $srcfh = delete $fgrp->{srcfh} or return; my $dstfh = delete $fgrp->{dstfh} or return; - seek($srcfh, SEEK_SET, 0); - seek($dstfh, SEEK_SET, 0); + seek($srcfh, 0, SEEK_SET); + seek($dstfh, 0, SEEK_SET); my %src = map { chomp; split(/\0/) } (<$srcfh>); close $srcfh; my %dst = map { chomp; split(/\0/) } (<$dstfh>); @@ -512,7 +512,7 @@ EOM my $f = "$o/info/alternates"; my $l = File::Spec->abs2rel($alt, File::Spec->rel2abs($o)); open my $fh, '+>>', $f; - seek($fh, SEEK_SET, 0); + seek($fh, 0, SEEK_SET); chomp(my @cur = <$fh>); if (!grep(/\A\Q$l\E\z/, @cur)) { say $fh $l; @@ -532,7 +532,7 @@ sub fp_done { } return if !keep_going($self); my $fh = delete $self->{-show_ref} // die 'BUG: no show-ref output'; - sysseek($fh, SEEK_SET, 0); + sysseek($fh, 0, SEEK_SET); $self->{-ent} // die 'BUG: no -ent'; my $A = $self->{-ent}->{fingerprint} // die 'BUG: no fingerprint'; my $B = sha_all(1, $fh)->hexdigest; @@ -729,7 +729,7 @@ sub up_fp_done { my ($self) = @_; return if !keep_going($self); my $fh = delete $self->{-show_ref_up} // die 'BUG: no show-ref output'; - sysseek($fh, SEEK_SET, 0); + sysseek($fh, 0, SEEK_SET); $self->{-ent} // die 'BUG: no -ent'; my $A = $self->{-ent}->{fingerprint} // die 'BUG: no fingerprint'; my $B = sha_all(1, $fh)->hexdigest; @@ -1083,7 +1083,7 @@ sub dump_manifest ($$) { # epoch they no longer want to skip my $json = PublicInbox::Config->json->encode($m); my $mtime = (stat($ft))[9]; - seek($ft, SEEK_SET, 0); + seek($ft, 0, SEEK_SET); truncate($ft, 0); gzip(\$json => $ft) or die "gzip($ft): $GzipError"; $ft->flush or die "flush($ft): $!";