summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2014-08-05 23:14:50 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2014-08-05 23:14:50 +0000
commit974e96c3f4d256046d3e685e4b04cb4746cf477e (patch)
treecccfff37ffb91a36d1b0155301c3c77be48363a5
parentb233ee2ec2f4c9563abe0fdafe9dcc9f15f8610b (diff)
downloadillumos-joyent-974e96c3f4d256046d3e685e4b04cb4746cf477e.tar.gz
OS-3310 ltp setgroups errno failures
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/misc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/misc.c b/usr/src/lib/brand/lx/lx_brand/common/misc.c
index 4b0020d551..87c3cf0351 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/misc.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/misc.c
@@ -277,6 +277,10 @@ lx_setgroups16(uintptr_t p1, uintptr_t p2)
for (i = 0; i < count; i++)
grouplist32[i] = LX_GID16_TO_GID32(grouplist[i]);
+ /* order matters here to get the correct errno back */
+ if (count > NGROUPS_MAX_DEFAULT)
+ return (-EINVAL);
+
return (setgroups(count, grouplist32) ? -errno : 0);
}
@@ -521,6 +525,10 @@ lx_setgroups(uintptr_t p1, uintptr_t p2)
}
}
+ /* order matters here to get the correct errno back */
+ if (ng > NGROUPS_MAX_DEFAULT)
+ return (-EINVAL);
+
r = syscall(SYS_brand, B_EMULATE_SYSCALL + LX_SYS_setgroups32,
ng, glist);