@@ -107,7 +107,10 @@ static pgut_option options[] =
107107int
108108main (int argc ,char * argv [])
109109{
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 );
111114
112115/* initialize configuration */
113116pgBackup_init (& current );
@@ -147,7 +150,7 @@ main(int argc, char *argv[])
147150}
148151
149152/* Parse command line arguments */
150- i = pgut_getopt (argc ,argv ,options );
153+ pgut_getopt (argc ,argv ,options );
151154
152155if (backup_path == NULL )
153156{
@@ -156,27 +159,20 @@ main(int argc, char *argv[])
156159if (backup_path == NULL )
157160elog (ERROR ,"required parameter not specified: BACKUP_PATH (-B, --backup-path)" );
158161}
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 );
165162
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" );
169166
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 );
176173
177- /* Read environment variables */
178- pgut_getopt_env (options );
179- }
174+ /* Read environment variables */
175+ pgut_getopt_env (options );
180176}
181177
182178if (backup_id_string_param != NULL )
@@ -205,10 +201,15 @@ main(int argc, char *argv[])
205201join_path_components (arclog_path ,backup_path ,"wal" );
206202
207203/* 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 */
209209
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+ }
212213
213214if (target_time != NULL && target_xid != NULL )
214215elog (ERROR ,"You can't specify recovery-target-time and recovery-target-xid at the same time" );