@@ -34,6 +34,7 @@ pg_control_system(PG_FUNCTION_ARGS)
3434 TupleDesc tupdesc ;
3535 HeapTuple htup ;
3636 ControlFileData * ControlFile ;
37+ bool crc_ok ;
3738
3839 /*
3940 * Construct a tuple descriptor for the result row. This must match this
@@ -51,8 +52,8 @@ pg_control_system(PG_FUNCTION_ARGS)
5152 tupdesc = BlessTupleDesc (tupdesc );
5253
5354 /* read the control file */
54- ControlFile = get_controlfile (DataDir , NULL );
55- if (!ControlFile )
55+ ControlFile = get_controlfile (DataDir , NULL , & crc_ok );
56+ if (!crc_ok )
5657 ereport (ERROR ,
5758 (errmsg ("calculated CRC checksum does not match value stored in file" )));
5859
@@ -83,6 +84,7 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
8384 ControlFileData * ControlFile ;
8485 XLogSegNo segno ;
8586 char xlogfilename [MAXFNAMELEN ];
87+ bool crc_ok ;
8688
8789 /*
8890 * Construct a tuple descriptor for the result row. This must match this
@@ -130,8 +132,8 @@ pg_control_checkpoint(PG_FUNCTION_ARGS)
130132 tupdesc = BlessTupleDesc (tupdesc );
131133
132134 /* Read the control file. */
133- ControlFile = get_controlfile (DataDir , NULL );
134- if (!ControlFile )
135+ ControlFile = get_controlfile (DataDir , NULL , & crc_ok );
136+ if (!crc_ok )
135137 ereport (ERROR ,
136138 (errmsg ("calculated CRC checksum does not match value stored in file" )));
137139
@@ -216,6 +218,7 @@ pg_control_recovery(PG_FUNCTION_ARGS)
216218 TupleDesc tupdesc ;
217219 HeapTuple htup ;
218220 ControlFileData * ControlFile ;
221+ bool crc_ok ;
219222
220223 /*
221224 * Construct a tuple descriptor for the result row. This must match this
@@ -235,8 +238,8 @@ pg_control_recovery(PG_FUNCTION_ARGS)
235238 tupdesc = BlessTupleDesc (tupdesc );
236239
237240 /* read the control file */
238- ControlFile = get_controlfile (DataDir , NULL );
239- if (!ControlFile )
241+ ControlFile = get_controlfile (DataDir , NULL , & crc_ok );
242+ if (!crc_ok )
240243 ereport (ERROR ,
241244 (errmsg ("calculated CRC checksum does not match value stored in file" )));
242245
@@ -268,6 +271,7 @@ pg_control_init(PG_FUNCTION_ARGS)
268271 TupleDesc tupdesc ;
269272 HeapTuple htup ;
270273 ControlFileData * ControlFile ;
274+ bool crc_ok ;
271275
272276 /*
273277 * Construct a tuple descriptor for the result row. This must match this
@@ -303,8 +307,8 @@ pg_control_init(PG_FUNCTION_ARGS)
303307 tupdesc = BlessTupleDesc (tupdesc );
304308
305309 /* read the control file */
306- ControlFile = get_controlfile (DataDir , NULL );
307- if (!ControlFile )
310+ ControlFile = get_controlfile (DataDir , NULL , & crc_ok );
311+ if (!crc_ok )
308312 ereport (ERROR ,
309313 (errmsg ("calculated CRC checksum does not match value stored in file" )));
310314
0 commit comments