Skip to content

Commit c5887e7

Browse files
committed
check that all required parameters are passed to archive-push and archive-get
1 parent 84fb036 commit c5887e7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

archive.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ do_archive_push(char *wal_file_path, char *wal_file_name)
3030
int64 system_id;
3131
pgBackupConfig *config;
3232

33+
if (wal_file_name == NULL && wal_file_path == NULL)
34+
elog(ERROR, "required parameters are not specified: --wal_file_name %%f --wal_file_path %%p");
35+
36+
if (wal_file_name == NULL)
37+
elog(ERROR, "required parameter not specified: --wal_file_name %%f");
38+
39+
if (wal_file_path == NULL)
40+
elog(ERROR, "required parameter not specified: --wal_file_path %%p");
41+
3342
if (!getcwd(current_dir, sizeof(current_dir)))
3443
elog(ERROR, "getcwd() error");
3544

@@ -74,6 +83,15 @@ do_archive_get(char *wal_file_path, char *wal_file_name)
7483
char absolute_wal_file_path[MAXPGPATH];
7584
char current_dir[MAXPGPATH];
7685

86+
if (wal_file_name == NULL && wal_file_path == NULL)
87+
elog(ERROR, "required parameters are not specified: --wal_file_name %%f --wal_file_path %%p");
88+
89+
if (wal_file_name == NULL)
90+
elog(ERROR, "required parameter not specified: --wal_file_name %%f");
91+
92+
if (wal_file_path == NULL)
93+
elog(ERROR, "required parameter not specified: --wal_file_path %%p");
94+
7795
if (!getcwd(current_dir, sizeof(current_dir)))
7896
elog(ERROR, "getcwd() error");
7997

0 commit comments

Comments
 (0)