1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-24 08:52:38 +02:00

Move state() under backup_path initialization

This commit is contained in:
Arthur Zakirov 2017-04-20 16:46:51 +03:00
parent 366073b01a
commit dc50ba791a

View File

@ -110,7 +110,7 @@ main(int argc, char *argv[])
char path[MAXPGPATH];
/* Check if backup_path is directory. */
struct stat stat_buf;
int rc = stat(backup_path, &stat_buf);
int rc;
/* initialize configuration */
pgBackup_init(&current);
@ -164,6 +164,7 @@ main(int argc, char *argv[])
elog(ERROR, "required parameter not specified: BACKUP_PATH (-B, --backup-path)");
}
rc = stat(backup_path, &stat_buf);
/* If rc == -1, there is no file or directory. So it's OK. */
if (rc != -1 && !S_ISDIR(stat_buf.st_mode))
elog(ERROR, "-B, --backup-path must be a path to directory");