aboutsummaryrefslogtreecommitdiff
path: root/src/common/controldata_utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/controldata_utils.c')
-rw-r--r--src/common/controldata_utils.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/common/controldata_utils.c b/src/common/controldata_utils.c
index 000f3c66d62..6289a4343ad 100644
--- a/src/common/controldata_utils.c
+++ b/src/common/controldata_utils.c
@@ -100,9 +100,18 @@ get_controlfile(const char *DataDir, const char *progname, bool *crc_ok_p)
}
#ifndef FRONTEND
- CloseTransientFile(fd);
+ if (CloseTransientFile(fd))
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("could not close file \"%s\": %m",
+ ControlFilePath)));
#else
- close(fd);
+ if (close(fd))
+ {
+ fprintf(stderr, _("%s: could not close file \"%s\": %s\n"),
+ progname, ControlFilePath, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
#endif
/* Check the CRC. */