We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f84a9a6 commit 721ba96Copy full SHA for 721ba96
1 file changed
src/misc.c
@@ -533,7 +533,7 @@ static int luv_getgroups(lua_State* L) {
533
if (ngroups > 0) {
534
groups = (gid_t*)malloc(ngroups * sizeof(gid_t));
535
}
536
- if (ngroups > 0 && !groups) {
+ if (!groups) {
537
return luaL_error(L, "Error allocating memory for groups");
538
539
@@ -560,6 +560,10 @@ static int luv_setgroups(lua_State* L) {
560
luaL_checktype(L, 1, LUA_TTABLE);
561
ngroups = lua_rawlen(L, 1);
562
563
+ if (ngroups < 1) {
564
+ return 0;
565
+ }
566
+
567
568
if (!groups && ngroups > 0) {
569
0 commit comments