mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-07 18:58:06 +02:00
weston-launch: Add some error reporting for weston-launch
This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc
This commit is contained in:
parent
6b8e17af60
commit
0b7b898289
1 changed files with 7 additions and 0 deletions
|
|
@ -84,11 +84,18 @@ read_groups(void)
|
|||
gid_t *groups;
|
||||
|
||||
n = getgroups(0, NULL);
|
||||
|
||||
if (n < 0) {
|
||||
fprintf(stderr, "Unable to retrieve groups: %m\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
groups = malloc(n * sizeof(gid_t));
|
||||
if (!groups)
|
||||
return NULL;
|
||||
|
||||
if (getgroups(n, groups) < 0) {
|
||||
fprintf(stderr, "Unable to retrieve groups: %m\n");
|
||||
free(groups);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue