Skip to content

Commit 0d9e756

Browse files
author
Mikhail Rutman
committed
[PGPRO-5756] fixed gcc-11 compilation warnings
1 parent 3ad0c98 commit 0d9e756

File tree

1 file changed

+2
-26
lines changed

1 file changed

+2
-26
lines changed

src/state.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2862,8 +2862,8 @@ MtmStateLoad(void)
28622862
fsync_fname("pg_mtm", true);
28632863

28642864

2865-
readBytes = read(fd, &ondisk, MtmStateOnDiskConstantSize);
2866-
if (readBytes != MtmStateOnDiskConstantSize)
2865+
readBytes = read(fd, &ondisk, sizeof(MtmStateOnDisk));
2866+
if (readBytes != sizeof(MtmStateOnDisk))
28672867
{
28682868
int save_errno = errno;
28692869

@@ -2896,30 +2896,6 @@ MtmStateLoad(void)
28962896
errmsg("mtm state file \"%s\" has unsupported version: %u instead of %u",
28972897
path, ondisk.version, MTMSTATE_VERSION)));
28982898

2899-
readBytes = read(fd, &ondisk.current_gen,
2900-
sizeof(MtmStateOnDisk) - MtmStateOnDiskConstantSize);
2901-
2902-
if (readBytes != (sizeof(MtmStateOnDisk) - MtmStateOnDiskConstantSize))
2903-
{
2904-
int save_errno = errno;
2905-
2906-
CloseTransientFile(fd);
2907-
2908-
if (readBytes < 0)
2909-
{
2910-
errno = save_errno;
2911-
ereport(ERROR,
2912-
(errcode_for_file_access(),
2913-
errmsg("could not read file \"%s\": %m", path)));
2914-
}
2915-
else
2916-
ereport(ERROR,
2917-
(errcode(ERRCODE_DATA_CORRUPTED),
2918-
errmsg("could not read file \"%s\": read %d of %zu",
2919-
path, readBytes,
2920-
sizeof(MtmStateOnDisk) - MtmStateOnDiskConstantSize)));
2921-
}
2922-
29232899
INIT_CRC32C(checksum);
29242900
COMP_CRC32C(checksum,
29252901
((char *) &ondisk) + MtmStateOnDiskNotChecksummedSize,

0 commit comments

Comments
 (0)