From: Henrik Kjölhede Date: Wed, 3 Jun 2015 13:22:46 +0000 (+0200) Subject: Changed parsing of allotments. Now parses top-to-bottom regardless of user or group X-Git-Tag: lxc-2.0.0.beta1~238^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af59ff2eede78085760819ea8846702a87eaf4c6;p=thirdparty%2Flxc.git Changed parsing of allotments. Now parses top-to-bottom regardless of user or group Signed-off-by: Henrik Kjölhede --- 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