summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2012-12-05 18:47:11 +0000
committerKristian Høgsberg <krh@bitplanet.net>2012-12-06 22:33:25 -0500
commit40be7b467f0ccbc52a816434863592ab20a82680 (patch)
treee61e7ff33435345c3ba75c65a7163644fd6795d5
parentc9e64abc5c7ed9b55fca998532c1947ab1e8d739 (diff)
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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/weston-launch.c b/src/weston-launch.c
index cb69968..6d1f7c3 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;
}