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