aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2019-07-06 23:18:46 +0200
committerPeter Eisentraut <peter@eisentraut.org>2019-07-07 15:28:49 +0200
commit7e9a4c5c3dca0d9637812d8991e96fc8f46800d9 (patch)
treeea48b3d7e575d88a8e4afeb9040dab178f9a2dab /src/backend/access/transam/xlog.c
parentd1a040543b49e0aad273e7766cd7e2fcf2b781fa (diff)
downloadpostgresql-7e9a4c5c3dca0d9637812d8991e96fc8f46800d9.tar.gz
postgresql-7e9a4c5c3dca0d9637812d8991e96fc8f46800d9.zip
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
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 13e0d2366f5..b6c9353cbd2 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -3321,7 +3321,7 @@ XLogFileInit(XLogSegNo logsegno, bool *use_existent, bool use_lock)
}
pgstat_report_wait_end();
- if (close(fd))
+ if (close(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", tmppath)));
@@ -3489,12 +3489,12 @@ XLogFileCopy(XLogSegNo destsegno, TimeLineID srcTLI, XLogSegNo srcsegno,
errmsg("could not fsync file \"%s\": %m", tmppath)));
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)));
- if (CloseTransientFile(srcfd))
+ if (CloseTransientFile(srcfd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
@@ -3791,7 +3791,7 @@ XLogFileClose(void)
(void) posix_fadvise(openLogFile, 0, 0, POSIX_FADV_DONTNEED);
#endif
- if (close(openLogFile))
+ if (close(openLogFile) != 0)
ereport(PANIC,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
@@ -4566,7 +4566,7 @@ WriteControlFile(void)
XLOG_CONTROL_FILE)));
pgstat_report_wait_end();
- if (close(fd))
+ if (close(fd) != 0)
ereport(PANIC,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
@@ -5225,7 +5225,7 @@ BootStrapXLOG(void)
errmsg("could not fsync bootstrap write-ahead log file: %m")));
pgstat_report_wait_end();
- if (close(openLogFile))
+ if (close(openLogFile) != 0)
ereport(PANIC,
(errcode_for_file_access(),
errmsg("could not close bootstrap write-ahead log file: %m")));
@@ -5527,7 +5527,7 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog)
fd = XLogFileInit(startLogSegNo, &use_existent, true);
- if (close(fd))
+ if (close(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",