-# ifdef HAVE_GETGROUPLIST
- /* Get all the process's groups, with the pw_gid group first. */
- gid_count = MAX_GID_LIST;
- if (getgrouplist(pw->pw_name, pw->pw_gid, gid_list, &gid_count) < 0) {
- rsyserr(FLOG, errno, "getgrouplist failed");
- io_printf(f_out, "@ERROR: getgrouplist failed\n");
- return NULL;
- }
- /* Paranoia: is the default group not first in the list? */
- if (gid_list[0] != pw->pw_gid) {
- int j;
- for (j = 0; j < gid_count; j++) {
- if (gid_list[j] == pw->pw_gid) {
- gid_list[j] = gid_list[0];
- gid_list[0] = pw->pw_gid;
- break;
- }
- }
- }
-# else