return ret == 0;
}
-bool lxc_setgroups(int size, gid_t list[])
+bool lxc_setgroups(gid_t list[], size_t size)
{
- if (setgroups(size, list) < 0) {
- SYSERROR("Failed to setgroups()");
- return false;
+ int ret;
+
+ ret = setgroups(size, list);
+ if (ret)
+ return log_error_errno(false, errno, "Failed to set supplimentary groups");
+
+ if (size > 0 && lxc_log_trace()) {
+ for (size_t i = 0; i < size; i++)
+ TRACE("Setting supplimentary group %d", list[i]);
}
- NOTICE("Dropped additional groups");
+ NOTICE("Set supplimentary groups");
return true;
}
* If LXC_INVALID_{G,U}ID is passed then the set{g,u}id() will not be called.
*/
__hidden extern bool lxc_switch_uid_gid(uid_t uid, gid_t gid);
-__hidden extern bool lxc_setgroups(int size, gid_t list[]);
+__hidden extern bool lxc_setgroups(gid_t list[], size_t size);
__hidden extern bool lxc_drop_groups(void);
/* Find an unused loop device and associate it with source. */