diff options
| author | Peter Melnichenko <mpeterval@gmail.com> | 2016-05-04 15:08:13 +0300 |
|---|---|---|
| committer | Peter Melnichenko <mpeterval@gmail.com> | 2016-05-05 12:39:17 +0300 |
| commit | 8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3 (patch) | |
| tree | f0a5307a3fd5f0b7089c77a437fb498772a0f524 /src | |
| parent | d186dda4d7229924678523e5ff59682780a9244f (diff) | |
| download | luafilesystem-8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3.tar.gz luafilesystem-8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3.tar.bz2 luafilesystem-8b85d257a6c6ed3cbe1c80240ab168b5f3117cc3.zip | |
Return errno from lfs.rmdir on error
Diffstat (limited to 'src')
| -rw-r--r-- | src/lfs.c | 14 |
1 files changed, 2 insertions, 12 deletions
| @@ -458,18 +458,8 @@ static int make_dir (lua_State *L) { | |||
| 458 | ** @param #1 Directory path. | 458 | ** @param #1 Directory path. |
| 459 | */ | 459 | */ |
| 460 | static int remove_dir (lua_State *L) { | 460 | static 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 | ||
