Skip to content

Commit

Permalink
Change the exit code logic of 'cf-check backup'
Browse files Browse the repository at this point in the history
Try to backup all files and report how many failed to be backed
up.
  • Loading branch information
vpodzime committed Oct 11, 2019
1 parent 17075e9 commit e636426
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cf-check/backup.c
Expand Up @@ -91,18 +91,23 @@ int backup_files(Seq *filenames)

Log(LOG_LEVEL_INFO, "Backing up to '%s'", backup_dir);

int ret = 0;
for (int i = 0; i < length; ++i)
{
const char *file = SeqAt(filenames, i);
if (!File_CopyToDir(file, backup_dir))
{
Log(LOG_LEVEL_ERR, "Copying '%s' failed", file);
return 1;
ret++;
}
}
return 0;
return ret;
}

/**
* @return the number of files that failed to be replicated or -1 in case of
* some internal failure
*/
int backup_main(int argc, const char *const *const argv)
{
Seq *files = argv_to_lmdb_files(argc, argv, 1);
Expand Down

0 comments on commit e636426

Please sign in to comment.