# HG changeset patch # User Matthew Wild # Date 1321632340 0 # Node ID 03e1295d599ae753cf932fe66188c021820a20f9 # Parent 0091db139229eab96de45eb0d3cc34226b7a2208# Parent aa2e79f209628d3f9b5b0d89cc2714f18053542c Merge with Zash diff -r aa2e79f20962 -r 03e1295d599a util-src/pposix.c --- a/util-src/pposix.c Sun Nov 06 00:51:39 2011 +0500 +++ b/util-src/pposix.c Fri Nov 18 16:05:40 2011 +0000 @@ -395,23 +395,27 @@ return 2; } ret = initgroups(lua_tostring(L, 1), gid); - switch(errno) + if(ret) { - case 0: + switch(errno) + { + case ENOMEM: + lua_pushnil(L); + lua_pushstring(L, "no-memory"); + break; + case EPERM: + lua_pushnil(L); + lua_pushstring(L, "permission-denied"); + break; + default: + lua_pushnil(L); + lua_pushstring(L, "unknown-error"); + } + } + else + { lua_pushboolean(L, 1); lua_pushnil(L); - break; - case ENOMEM: - lua_pushnil(L); - lua_pushstring(L, "no-memory"); - break; - case EPERM: - lua_pushnil(L); - lua_pushstring(L, "permission-denied"); - break; - default: - lua_pushnil(L); - lua_pushstring(L, "unknown-error"); } return 2; }