aboutsummaryrefslogtreecommitdiffstats
path: root/ports/darwin/guts/getgroups.c
blob: 7aba660b7df9c4aad7dbada73b8baff5164538fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* 
 * Copyright (c) 2010 Wind River Systems; see
 * guts/COPYRIGHT for information.
 *
 * SPDX-License-Identifier: LGPL-2.1-only
 *
 * static int
 * wrap_getgroups(int size, gid_t *list) {
 *	int rc = -1;
 */
	struct passwd *p = wrap_getpwuid(wrap_getuid());
	int oldsize = size;

	if (p) {
		rc = wrap_getgrouplist(p->pw_name, wrap_getgid(), (int *) list, &size);
		if (oldsize == 0 || size <= oldsize)
			rc = size;
	} else {
		errno = ENOENT;
	}

/*	return rc;
 * }
 */