diff -rNaud shadow-4.1.4/src/groups.c shadow-4.1.4-new/src/groups.c --- shadow-4.1.4/src/groups.c 2009-04-30 17:08:50.000000000 -0400 +++ shadow-4.1.4-new/src/groups.c 2009-07-22 14:10:26.000000000 -0400 @@ -66,7 +66,16 @@ Prog, member); exit (EXIT_FAILURE); } + + /* first we get the main group (patched by JP Guillemin for Zenwalk GNU/Linux) */ + if (!flag && (grp = getgrgid (pwd->pw_gid))) { + if (groups++) + putchar (' '); + (void) printf ("%s", grp->gr_name); + } + + /* then we get secondary groups */ setgrent (); while ((grp = getgrent ()) != NULL) { if (is_on_list (grp->gr_mem, member)) { @@ -83,19 +92,6 @@ } endgrent (); - /* The user may not be in the list of members of its primary group */ - if (!flag) { - grp = getgrgid (pwd->pw_gid); /* local, no need for xgetgrgid */ - if (NULL != grp) { - if (0 != groups) { - (void) putchar (' '); - } - groups++; - - (void) printf ("%s", grp->gr_name); - } - } - if (0 != groups) { (void) putchar ('\n'); }