From af59ff2eede78085760819ea8846702a87eaf4c6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Henrik=20Kj=C3=B6lhede?= Date: Wed, 3 Jun 2015 15:22:46 +0200 Subject: [PATCH] Changed parsing of allotments. Now parses top-to-bottom regardless of user or group MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Henrik Kjölhede --- src/lxc/lxc_user_nic.c | 117 ++++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 59 deletions(-) diff --git a/src/lxc/lxc_user_nic.c b/src/lxc/lxc_user_nic.c index bdd603766..0fefc4c1a 100644 --- a/src/lxc/lxc_user_nic.c +++ b/src/lxc/lxc_user_nic.c @@ -102,15 +102,15 @@ static char **get_groupnames(void) int ngroups; gid_t *group_ids; int ret, i, j; - char **group_names; + char **groupnames; struct group *gr; ngroups = getgroups(0, NULL); - if (ngroups == -1) { - fprintf(stderr, "Failed to get number of groups user belongs to\n"); - return NULL; - } + if (ngroups == -1) { + fprintf(stderr, "Failed to get number of groups user belongs to\n"); + return NULL; + } group_ids = (gid_t *)malloc(sizeof(gid_t)*ngroups); ret = getgroups(ngroups, group_ids); @@ -121,7 +121,7 @@ static char **get_groupnames(void) return NULL; } - group_names = (char **)malloc(sizeof(char *)*(ngroups+1)); + groupnames = (char **)malloc(sizeof(char *)*(ngroups+1)); for (i=0; igr_name); + groupnames[i] = strdup(gr->gr_name); - if (group_names[i] == NULL) { + if (groupnames[i] == NULL) { fprintf(stderr, "Failed to copy group name: %s", gr->gr_name); free(group_ids); for (j=0; j