diff options
author | Robert Haas <rhaas@postgresql.org> | 2012-06-14 15:20:08 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2012-06-14 15:20:08 -0400 |
commit | 8507c2f8564b709bb6a3cc86e9599f6129f45c8e (patch) | |
tree | 68b7811affa6b1ec0dd81b40852e0135a652a6c9 /src/backend/access/transam/xlogfuncs.c | |
parent | c616d85f6b6c7bd160c71583e2445b460eee8e3d (diff) | |
download | postgresql-8507c2f8564b709bb6a3cc86e9599f6129f45c8e.tar.gz postgresql-8507c2f8564b709bb6a3cc86e9599f6129f45c8e.zip |
Improve readability and error messages in pg_backup_start_time.
Gurjeet Singh, with corrections by me.
Diffstat (limited to 'src/backend/access/transam/xlogfuncs.c')
-rw-r--r-- | src/backend/access/transam/xlogfuncs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index d94809ad7ee..adf0b16e56a 100644 --- a/src/backend/access/transam/xlogfuncs.c +++ b/src/backend/access/transam/xlogfuncs.c @@ -611,14 +611,18 @@ pg_backup_start_time(PG_FUNCTION_ARGS) break; } - /* - * Close the backup label file. - */ - if (ferror(lfp) || FreeFile(lfp)) + /* Check for a read error. */ + if (ferror(lfp)) ereport(ERROR, (errcode_for_file_access(), 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) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), |