Software /
code /
prosody
Changeset
4416:03e1295d599a
Merge with Zash
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 18 Nov 2011 16:05:40 +0000 |
parents | 4415:0091db139229 (diff) 4414:aa2e79f20962 (current diff) |
children | 4417:33c149394dcb |
files | |
diffstat | 1 files changed, 18 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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; }