@@ -107,7 +107,10 @@ static pgut_option options[] =
107
107
int
108
108
main (int argc ,char * argv [])
109
109
{
110
- int i ;
110
+ char path [MAXPGPATH ];
111
+ /* Check if backup_path is directory. */
112
+ struct stat stat_buf ;
113
+ int rc = stat (backup_path ,& stat_buf );
111
114
112
115
/* initialize configuration */
113
116
pgBackup_init (& current );
@@ -147,7 +150,7 @@ main(int argc, char *argv[])
147
150
}
148
151
149
152
/* Parse command line arguments */
150
- i = pgut_getopt (argc ,argv ,options );
153
+ pgut_getopt (argc ,argv ,options );
151
154
152
155
if (backup_path == NULL )
153
156
{
@@ -156,27 +159,20 @@ main(int argc, char *argv[])
156
159
if (backup_path == NULL )
157
160
elog (ERROR ,"required parameter not specified: BACKUP_PATH (-B, --backup-path)" );
158
161
}
159
- else
160
- {
161
- char path [MAXPGPATH ];
162
- /* Check if backup_path is directory. */
163
- struct stat stat_buf ;
164
- int rc = stat (backup_path ,& stat_buf );
165
162
166
- /* If rc == -1, there is no file or directory. So it's OK. */
167
- if (rc != -1 && !S_ISDIR (stat_buf .st_mode ))
168
- elog (ERROR ,"-B, --backup-path must be a path to directory" );
163
+ /* If rc == -1, there is no file or directory. So it's OK. */
164
+ if (rc != -1 && !S_ISDIR (stat_buf .st_mode ))
165
+ elog (ERROR ,"-B, --backup-path must be a path to directory" );
169
166
170
- /* Do not read options from file or env if we're going to set them */
171
- if (backup_subcmd != CONFIGURE )
172
- {
173
- /* Read options from configuration file */
174
- join_path_components (path ,backup_path ,BACKUP_CATALOG_CONF_FILE );
175
- pgut_readopt (path ,options ,ERROR );
167
+ /* Do not read options from file or env if we're going to set them */
168
+ if (backup_subcmd != CONFIGURE )
169
+ {
170
+ /* Read options from configuration file */
171
+ join_path_components (path ,backup_path ,BACKUP_CATALOG_CONF_FILE );
172
+ pgut_readopt (path ,options ,ERROR );
176
173
177
- /* Read environment variables */
178
- pgut_getopt_env (options );
179
- }
174
+ /* Read environment variables */
175
+ pgut_getopt_env (options );
180
176
}
181
177
182
178
if (backup_id_string_param != NULL )
@@ -205,10 +201,15 @@ main(int argc, char *argv[])
205
201
join_path_components (arclog_path ,backup_path ,"wal" );
206
202
207
203
/* setup exclusion list for file search */
208
- for (i = 0 ;pgdata_exclude_dir [i ];i ++ );/* find first empty slot */
204
+ if (!backup_logs )
205
+ {
206
+ int i ;
207
+
208
+ for (i = 0 ;pgdata_exclude_dir [i ];i ++ );/* find first empty slot */
209
209
210
- if (!backup_logs )
211
- pgdata_exclude_dir [i ++ ]= "pg_log" ;
210
+ /* Set 'pg_log' in first empty slot */
211
+ pgdata_exclude_dir [i ]= "pg_log" ;
212
+ }
212
213
213
214
if (target_time != NULL && target_xid != NULL )
214
215
elog (ERROR ,"You can't specify recovery-target-time and recovery-target-xid at the same time" );