Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
config migrate: run check only when version changed
  • Loading branch information
perexg committed Sep 8, 2014
1 parent 82c5182 commit 0fa7365
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/config.c
Expand Up @@ -872,7 +872,7 @@ static const config_migrate_t config_migrate_table[] = {
/*
* Perform migrations (if required)
*/
static void
static int
config_migrate ( void )
{
uint32_t v;
Expand All @@ -890,7 +890,7 @@ config_migrate ( void )

/* No changes required */
if (v == ARRAY_SIZE(config_migrate_table))
return;
return 0;

/* Run migrations */
for ( ; v < ARRAY_SIZE(config_migrate_table); v++) {
Expand All @@ -901,6 +901,7 @@ config_migrate ( void )
/* Update */
htsmsg_set_u32(config, "version", v);
config_save();
return 1;
}

/*
Expand All @@ -922,6 +923,7 @@ config_check_one ( const char *dir )
exit(1);
}
}
htsmsg_destroy(c);
}

/*
Expand Down Expand Up @@ -993,8 +995,8 @@ config_init ( const char *path )

/* Perform migrations */
} else {
config_migrate();
config_check();
if (config_migrate())
config_check();
}
}

Expand Down

0 comments on commit 0fa7365

Please sign in to comment.