mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Use consistent style for checking return from system calls
Use if (something() != 0) error ... instead of just if (something) error ... The latter is not incorrect, but it's a bit confusing and not the common style. Discussion: https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com
This commit is contained in:
@@ -650,7 +650,7 @@ CheckPointReplicationOrigin(void)
|
||||
tmppath)));
|
||||
}
|
||||
|
||||
if (CloseTransientFile(tmpfd))
|
||||
if (CloseTransientFile(tmpfd) != 0)
|
||||
ereport(PANIC,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not close file \"%s\": %m",
|
||||
@@ -789,7 +789,7 @@ StartupReplicationOrigin(void)
|
||||
errmsg("replication slot checkpoint has wrong checksum %u, expected %u",
|
||||
crc, file_crc)));
|
||||
|
||||
if (CloseTransientFile(fd))
|
||||
if (CloseTransientFile(fd) != 0)
|
||||
ereport(PANIC,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not close file \"%s\": %m",
|
||||
|
@@ -3360,7 +3360,7 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
|
||||
}
|
||||
}
|
||||
|
||||
if (CloseTransientFile(fd))
|
||||
if (CloseTransientFile(fd) != 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not close file \"%s\": %m", path)));
|
||||
|
@@ -1652,7 +1652,7 @@ SnapBuildSerialize(SnapBuild *builder, XLogRecPtr lsn)
|
||||
}
|
||||
pgstat_report_wait_end();
|
||||
|
||||
if (CloseTransientFile(fd))
|
||||
if (CloseTransientFile(fd) != 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not close file \"%s\": %m", tmppath)));
|
||||
@@ -1850,7 +1850,7 @@ SnapBuildRestore(SnapBuild *builder, XLogRecPtr lsn)
|
||||
}
|
||||
COMP_CRC32C(checksum, ondisk.builder.committed.xip, sz);
|
||||
|
||||
if (CloseTransientFile(fd))
|
||||
if (CloseTransientFile(fd) != 0)
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not close file \"%s\": %m", path)));
|
||||
|
Reference in New Issue
Block a user