Skip to content

Commit

Permalink
confile: do not overwrite global variable
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Nov 22, 2018
1 parent cf5e424 commit 1d2d92c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/lxc/confile.c
Expand Up @@ -151,7 +151,7 @@ lxc_config_define(uts_name);
lxc_config_define(sysctl);
lxc_config_define(proc);

static struct lxc_config_t config[] = {
static struct lxc_config_t config_jump_table[] = {
{ "lxc.arch", set_config_personality, get_config_personality, clr_config_personality, },
{ "lxc.apparmor.profile", set_config_apparmor_profile, get_config_apparmor_profile, clr_config_apparmor_profile, },
{ "lxc.apparmor.allow_incomplete", set_config_apparmor_allow_incomplete, get_config_apparmor_allow_incomplete, clr_config_apparmor_allow_incomplete, },
Expand Down Expand Up @@ -236,15 +236,15 @@ static struct lxc_config_t config[] = {
{ "lxc.proc", set_config_proc, get_config_proc, clr_config_proc, },
};

static const size_t config_size = sizeof(config) / sizeof(struct lxc_config_t);
static const size_t config_jump_table_size = sizeof(config_jump_table) / sizeof(struct lxc_config_t);

struct lxc_config_t *lxc_get_config(const char *key)
{
size_t i;

for (i = 0; i < config_size; i++)
if (!strncmp(config[i].name, key, strlen(config[i].name)))
return &config[i];
for (i = 0; i < config_jump_table_size; i++)
if (!strncmp(config_jump_table[i].name, key, strlen(config_jump_table[i].name)))
return &config_jump_table[i];

return NULL;
}
Expand Down Expand Up @@ -4929,8 +4929,8 @@ int lxc_list_config_items(char *retv, int inlen)
else
memset(retv, 0, inlen);

for (i = 0; i < config_size; i++) {
char *s = config[i].name;
for (i = 0; i < config_jump_table_size; i++) {
char *s = config_jump_table[i].name;

if (s[strlen(s) - 1] == '.')
continue;
Expand Down

0 comments on commit 1d2d92c

Please sign in to comment.