Return errno from lfs.rmdir on error

This commit is contained in:
Peter Melnichenko
2016-05-04 15:08:13 +03:00
parent d186dda4d7
commit 8b85d257a6

View File

@@ -458,18 +458,8 @@ static int make_dir (lua_State *L) {
** @param #1 Directory path.
*/
static int remove_dir (lua_State *L) {
const char *path = luaL_checkstring (L, 1);
int fail;
fail = rmdir (path);
if (fail) {
lua_pushnil (L);
lua_pushfstring (L, "%s", strerror(errno));
return 2;
}
lua_pushboolean (L, 1);
return 1;
const char *path = luaL_checkstring(L, 1);
return pushresult(L, rmdir(path), NULL);
}