Commit 8507c2f8 authored by Robert Haas's avatar Robert Haas

Improve readability and error messages in pg_backup_start_time.

Gurjeet Singh, with corrections by me.
parent c616d85f
...@@ -611,14 +611,18 @@ pg_backup_start_time(PG_FUNCTION_ARGS) ...@@ -611,14 +611,18 @@ pg_backup_start_time(PG_FUNCTION_ARGS)
break; break;
} }
/* /* Check for a read error. */
* Close the backup label file. if (ferror(lfp))
*/
if (ferror(lfp) || FreeFile(lfp))
ereport(ERROR, ereport(ERROR,
(errcode_for_file_access(), (errcode_for_file_access(),
errmsg("could not read file \"%s\": %m", BACKUP_LABEL_FILE))); errmsg("could not read file \"%s\": %m", BACKUP_LABEL_FILE)));
/* Close the backup label file. */
if (FreeFile(lfp))
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not close file \"%s\": %m", BACKUP_LABEL_FILE)));
if (strlen(backup_start_time) == 0) if (strlen(backup_start_time) == 0)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment