diff options
author | Rob Bradford <rob@linux.intel.com> | 2012-12-05 18:47:11 +0000 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-12-11 23:47:47 -0500 |
commit | 0b7b8982891a06e4a6008f699c07b732e456de8c (patch) | |
tree | 1c05db4faa0db32ec7d58ece0719b31aca656dc9 | |
parent | 6b8e17af605a34dbe92a7f2102fb60e59bb158d1 (diff) | |
download | weston-0b7b8982891a06e4a6008f699c07b732e456de8c.tar.gz |
weston-launch: Add some error reporting for weston-launch
This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc
-rw-r--r-- | src/weston-launch.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/weston-launch.c b/src/weston-launch.c index cb69968a..6d1f7c3b 100644 --- a/src/weston-launch.c +++ b/src/weston-launch.c @@ -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; } |