diff options
Diffstat (limited to 'src/backend/utils/misc/pg_controldata.c')
-rw-r--r-- | src/backend/utils/misc/pg_controldata.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/backend/utils/misc/pg_controldata.c b/src/backend/utils/misc/pg_controldata.c index 4f9de830974..0c67833f60b 100644 --- a/src/backend/utils/misc/pg_controldata.c +++ b/src/backend/utils/misc/pg_controldata.c @@ -34,6 +34,7 @@ pg_control_system(PG_FUNCTION_ARGS) TupleDesc tupdesc; HeapTuple htup; ControlFileData *ControlFile; + bool crc_ok; /* * Construct a tuple descriptor for the result row. This must match this @@ -51,8 +52,8 @@ pg_control_system(PG_FUNCTION_ARGS) tupdesc = BlessTupleDesc(tupdesc); /* read the control file */ - ControlFile = get_controlfile(DataDir, NULL); - if (!ControlFile) + ControlFile = get_controlfile(DataDir, NULL, &crc_ok); + if (!crc_ok) ereport(ERROR, (errmsg("calculated CRC checksum does not match value stored in file"))); @@ -83,6 +84,7 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) ControlFileData *ControlFile; XLogSegNo segno; char xlogfilename[MAXFNAMELEN]; + bool crc_ok; /* * Construct a tuple descriptor for the result row. This must match this @@ -130,8 +132,8 @@ pg_control_checkpoint(PG_FUNCTION_ARGS) tupdesc = BlessTupleDesc(tupdesc); /* Read the control file. */ - ControlFile = get_controlfile(DataDir, NULL); - if (!ControlFile) + ControlFile = get_controlfile(DataDir, NULL, &crc_ok); + if (!crc_ok) ereport(ERROR, (errmsg("calculated CRC checksum does not match value stored in file"))); @@ -216,6 +218,7 @@ pg_control_recovery(PG_FUNCTION_ARGS) TupleDesc tupdesc; HeapTuple htup; ControlFileData *ControlFile; + bool crc_ok; /* * Construct a tuple descriptor for the result row. This must match this @@ -235,8 +238,8 @@ pg_control_recovery(PG_FUNCTION_ARGS) tupdesc = BlessTupleDesc(tupdesc); /* read the control file */ - ControlFile = get_controlfile(DataDir, NULL); - if (!ControlFile) + ControlFile = get_controlfile(DataDir, NULL, &crc_ok); + if (!crc_ok) ereport(ERROR, (errmsg("calculated CRC checksum does not match value stored in file"))); @@ -268,6 +271,7 @@ pg_control_init(PG_FUNCTION_ARGS) TupleDesc tupdesc; HeapTuple htup; ControlFileData *ControlFile; + bool crc_ok; /* * Construct a tuple descriptor for the result row. This must match this @@ -303,8 +307,8 @@ pg_control_init(PG_FUNCTION_ARGS) tupdesc = BlessTupleDesc(tupdesc); /* read the control file */ - ControlFile = get_controlfile(DataDir, NULL); - if (!ControlFile) + ControlFile = get_controlfile(DataDir, NULL, &crc_ok); + if (!crc_ok) ereport(ERROR, (errmsg("calculated CRC checksum does not match value stored in file"))); |