return NULL;
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(LOG,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", PGSS_TEXT_FILE)));
errmsg("could not fsync file \"%s\": %m", path)));
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
errmsg("could not fsync file \"%s\": %m", path)));
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
result = endpos >= (off_t) (offset + BLCKSZ);
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
slru_errcause = SLRU_CLOSE_FAILED;
slru_errno = errno;
}
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
slru_errcause = SLRU_CLOSE_FAILED;
slru_errno = errno;
if (!fdata)
{
pgstat_report_wait_start(WAIT_EVENT_SLRU_SYNC);
- if (ctl->do_fsync && pg_fsync(fd))
+ if (ctl->do_fsync && pg_fsync(fd) != 0)
{
pgstat_report_wait_end();
slru_errcause = SLRU_FSYNC_FAILED;
}
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
slru_errcause = SLRU_CLOSE_FAILED;
slru_errno = errno;
for (i = 0; i < fdata.num_files; i++)
{
pgstat_report_wait_start(WAIT_EVENT_SLRU_FLUSH_SYNC);
- if (ctl->do_fsync && pg_fsync(fdata.fd[i]))
+ if (ctl->do_fsync && pg_fsync(fdata.fd[i]) != 0)
{
slru_errcause = SLRU_FSYNC_FAILED;
slru_errno = errno;
}
pgstat_report_wait_end();
- if (CloseTransientFile(fdata.fd[i]))
+ if (CloseTransientFile(fdata.fd[i]) != 0)
{
slru_errcause = SLRU_CLOSE_FAILED;
slru_errno = errno;
pgstat_report_wait_end();
}
- if (CloseTransientFile(srcfd))
+ if (CloseTransientFile(srcfd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
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)));
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)));
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
}
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)));
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)));
(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",
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",
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")));
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",
inv_close(lobj);
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
fnamebuf)));
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
* do this as early as possible, so that if postmaster dies, others won't
* think that it's still running because we're holding the pipe open.
*/
- if (close(postmaster_alive_fds[POSTMASTER_FD_OWN]))
+ if (close(postmaster_alive_fds[POSTMASTER_FD_OWN]) != 0)
ereport(FATAL,
(errcode_for_file_access(),
errmsg_internal("could not close postmaster death monitoring pipe in child process: %m")));
tmppath)));
}
- if (CloseTransientFile(tmpfd))
+ if (CloseTransientFile(tmpfd) != 0)
ereport(PANIC,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
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",
}
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
}
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)));
}
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)));
}
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
ereport(elevel,
(errcode_for_file_access(),
path, readBytes, (Size) cp.length)));
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(PANIC,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
bytesleft -= nread;
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", path)));
if (offset > flush_offset)
pg_flush_data(dstfd, flush_offset, offset - flush_offset);
- if (CloseTransientFile(dstfd))
+ if (CloseTransientFile(dstfd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", tofile)));
- if (CloseTransientFile(srcfd))
+ if (CloseTransientFile(srcfd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", fromfile)));
return -1;
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
ereport(elevel,
(errcode_for_file_access(),
* Close the file. We aren't expecting this to fail; if it does, better
* to leak the FD than to mess up our internal state.
*/
- if (close(vfdP->fd))
+ if (close(vfdP->fd) != 0)
elog(vfdP->fdstate & FD_TEMP_FILE_LIMIT ? LOG : data_sync_elevel(LOG),
"could not close file \"%s\": %m", vfdP->fileName);
vfdP->fd = VFD_CLOSED;
if (!FileIsNotOpen(file))
{
/* close the file */
- if (close(vfdP->fd))
+ if (close(vfdP->fd) != 0)
{
/*
* We may need to panic on failure to close non-temporary files;
*/
pg_flush_data(fd, 0, 0);
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(elevel,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", fname)));
return -1;
}
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
ereport(elevel,
(errcode_for_file_access(),
*mapped_address = address;
*mapped_size = request_size;
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
{
ereport(elevel,
(errcode_for_file_access(),
}
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(FATAL,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
mapfilename)));
pgstat_report_wait_end();
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
}
#ifndef FRONTEND
- if (CloseTransientFile(fd))
+ if (CloseTransientFile(fd) != 0)
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m",
ControlFilePath)));
#else
- if (close(fd))
+ if (close(fd) != 0)
{
pg_log_fatal("could not close file \"%s\": %m", ControlFilePath);
exit(EXIT_FAILURE);
#endif
}
- if (close(fd) < 0)
+ if (close(fd) != 0)
{
#ifndef FRONTEND
ereport(PANIC,
}
/* if we already failed, don't overwrite that msg with a close error */
- if (close(fd) && result >= 0)
+ if (close(fd) != 0 && result >= 0)
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("could not write to file \"%s\": %s\n"),