[PATCH 9/9] weston-launch: Add some error reporting for weston-launch
Rob Bradford
robert.bradford at intel.com
Wed Dec 5 10:47:11 PST 2012
From: Rob Bradford <rob at linux.intel.com>
This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc
---
src/weston-launch.c | 7 +++++++
1 file changed, 7 insertions(+)
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;
}
--
1.7.11.7
More information about the wayland-devel
mailing list