A couple of tests have been using 0 as magic constant while SEEK_SET can
be used instead. This makes the code easier to understand, and more
consistent with the changes done in
3c5b068.
Per discussion with Andrew Dunstan.
Discussion: https://postgr.es/m/YHrc24AgJQ6tQ1q0@paquier.xyz
index 6050feb71215c0700147a5904dcd4ba5fe2a474f..bf47c2ed37315f153a556f3917f53240a970739d 100644 (file)
use PostgresNode;
use TestLib;
+use Fcntl qw(:seek);
use Test::More tests => 80;
my ($node, $result);
# Corrupt some line pointers. The values are chosen to hit the
# various line-pointer-corruption checks in verify_heapam.c
# on both little-endian and big-endian architectures.
- seek($fh, 32, 0)
+ seek($fh, 32, SEEK_SET)
or BAIL_OUT("seek failed: $!");
syswrite(
$fh,
index 66dd14e498bf634ed2592012e846ab274a5ee195..2da9631da4a61d452ed1f43ec404fd06b6544c01 100644 (file)
use PostgresNode;
use TestLib;
+
+use Fcntl qw(:seek);
use Test::More tests => 63;
my ($node, $port, %corrupt_page, %remove_relation);
# Corrupt some line pointers. The values are chosen to hit the
# various line-pointer-corruption checks in verify_heapam.c
# on both little-endian and big-endian architectures.
- seek($fh, 32, 0)
+ seek($fh, 32, SEEK_SET)
or BAIL_OUT("seek failed: $!");
syswrite(
$fh,
index 3c1277adf3e1cb39b6e2f3f520db5c0bf0ce6be5..b842f7bc6db0853674b17b82f59c13a83b31cca9 100644 (file)
use PostgresNode;
use TestLib;
+use Fcntl qw(:seek);
use Test::More;
# This regression test demonstrates that the pg_amcheck binary correctly
{
my ($fh, $offset) = @_;
my ($buffer, %tup);
- seek($fh, $offset, 0)
+ seek($fh, $offset, SEEK_SET)
or BAIL_OUT("seek failed: $!");
defined(sysread($fh, $buffer, HEAPTUPLE_PACK_LENGTH))
or BAIL_OUT("sysread failed: $!");
$tup->{c_va_extinfo},
$tup->{c_va_valueid},
$tup->{c_va_toastrelid});
- seek($fh, $offset, 0)
+ seek($fh, $offset, SEEK_SET)
or BAIL_OUT("seek failed: $!");
defined(syswrite($fh, $buffer, HEAPTUPLE_PACK_LENGTH))
or BAIL_OUT("syswrite failed: $!");
index 089c9cb851aa85187914253e22593910f66b6282..a9dfe88aaae83321456bede5f92ddbb16c8c5919 100644 (file)
use Config;
use File::Basename qw(basename dirname);
use File::Path qw(rmtree);
+use Fcntl qw(:seek);
use PostgresNode;
use TestLib;
use Test::More tests => 110;
@@ -555,7 +556,7 @@ my $block_size = $node->safe_psql('postgres', 'SHOW block_size;');
# induce corruption
system_or_bail 'pg_ctl', '-D', $pgdata, 'stop';
open $file, '+<', "$pgdata/$file_corrupt1";
-seek($file, $pageheader_size, 0);
+seek($file, $pageheader_size, SEEK_SET);
syswrite($file, "0円0円0円0円0円0円0円0円0円");
close $file;
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
@@ -574,7 +575,7 @@ open $file, '+<', "$pgdata/$file_corrupt1";
for my $i (1 .. 5)
{
my $offset = $pageheader_size + $i * $block_size;
- seek($file, $offset, 0);
+ seek($file, $offset, SEEK_SET);
syswrite($file, "0円0円0円0円0円0円0円0円0円");
}
close $file;
# induce corruption in a second file
system_or_bail 'pg_ctl', '-D', $pgdata, 'stop';
open $file, '+<', "$pgdata/$file_corrupt2";
-seek($file, $pageheader_size, 0);
+seek($file, $pageheader_size, SEEK_SET);
syswrite($file, "0円0円0円0円0円0円0円0円0円");
close $file;
system_or_bail 'pg_ctl', '-D', $pgdata, 'start';
index 8a81f36a067fdac7aa149c4ab7ed32d0c255b101..d52bbac5faa97c33a76fa3b66d82421f10c2ead4 100644 (file)
use warnings;
use PostgresNode;
use TestLib;
+
+use Fcntl qw(:seek);
use Test::More tests => 63;
# Time to create some corruption
open my $file, '+<', "$pgdata/$file_corrupted";
- seek($file, $pageheader_size, 0);
+ seek($file, $pageheader_size, SEEK_SET);
syswrite($file, "0円0円0円0円0円0円0円0円0円");
close $file;