From 8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3 Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Wed, 4 May 2016 15:08:13 +0300 Subject: Return errno from lfs.rmdir on error --- src/lfs.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/lfs.c b/src/lfs.c index 25535ce..2ead179 100644 --- a/src/lfs.c +++ b/src/lfs.c @@ -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); } -- cgit v1.2.3-55-g6feb