aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Melnichenko <mpeterval@gmail.com>2016-05-04 15:08:13 +0300
committerPeter Melnichenko <mpeterval@gmail.com>2016-05-05 12:39:17 +0300
commit8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3 (patch)
treef0a5307a3fd5f0b7089c77a437fb498772a0f524
parentd186dda4d7229924678523e5ff59682780a9244f (diff)
downloadluafilesystem-8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3.tar.gz
luafilesystem-8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3.tar.bz2
luafilesystem-8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3.zip
Return errno from lfs.rmdir on error
-rw-r--r--src/lfs.c14
1 files 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) {
458** @param #1 Directory path. 458** @param #1 Directory path.
459*/ 459*/
460static int remove_dir (lua_State *L) { 460static int remove_dir (lua_State *L) {
461 const char *path = luaL_checkstring (L, 1); 461 const char *path = luaL_checkstring(L, 1);
462 int fail; 462 return pushresult(L, rmdir(path), NULL);
463
464 fail = rmdir (path);
465
466 if (fail) {
467 lua_pushnil (L);
468 lua_pushfstring (L, "%s", strerror(errno));
469 return 2;
470 }
471 lua_pushboolean (L, 1);
472 return 1;
473} 463}
474 464
475 465