diff options
| author | tomas <tomas> | 2004-11-05 10:54:28 +0000 |
|---|---|---|
| committer | tomas <tomas> | 2004-11-05 10:54:28 +0000 |
| commit | c9286d40fe9cacfa022e6ee98905dda9eec6d8b1 (patch) | |
| tree | ad02d1a71348af9b7c3586921f742b9bc5ff9db5 | |
| parent | 2bc7cbf743631ab8317576b58e98159d3ca08dcc (diff) | |
| download | luafilesystem-c9286d40fe9cacfa022e6ee98905dda9eec6d8b1.tar.gz luafilesystem-c9286d40fe9cacfa022e6ee98905dda9eec6d8b1.tar.bz2 luafilesystem-c9286d40fe9cacfa022e6ee98905dda9eec6d8b1.zip | |
Correcoes em valores de retorno de funcoes.
| -rw-r--r-- | src/lfs.c | 6 | ||||
| -rw-r--r-- | tests/test.lua | 4 |
2 files changed, 6 insertions, 4 deletions
| @@ -9,7 +9,7 @@ | |||
| 9 | ** lfs.lock (fh, mode) | 9 | ** lfs.lock (fh, mode) |
| 10 | ** lfs.unlock (fh) | 10 | ** lfs.unlock (fh) |
| 11 | ** | 11 | ** |
| 12 | ** $Id: lfs.c,v 1.11 2004/11/05 10:37:29 tomas Exp $ | 12 | ** $Id: lfs.c,v 1.12 2004/11/05 10:54:28 tomas Exp $ |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <errno.h> | 15 | #include <errno.h> |
| @@ -239,8 +239,10 @@ static int make_dir (lua_State *L) { | |||
| 239 | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH ); | 239 | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH ); |
| 240 | #endif | 240 | #endif |
| 241 | lua_pushboolean (L, !fail); | 241 | lua_pushboolean (L, !fail); |
| 242 | if (fail) | 242 | if (fail) { |
| 243 | lua_pushfstring (L, "%s", strerror(errno)); | 243 | lua_pushfstring (L, "%s", strerror(errno)); |
| 244 | return 2; | ||
| 245 | } | ||
| 244 | umask (oldmask); | 246 | umask (oldmask); |
| 245 | return 1; | 247 | return 1; |
| 246 | } | 248 | } |
diff --git a/tests/test.lua b/tests/test.lua index 5703bfb..25a3fd3 100644 --- a/tests/test.lua +++ b/tests/test.lua | |||
| @@ -30,11 +30,11 @@ local reldir = string.gsub (current, "^.*%"..sep.."([^"..sep.."])$", "%1") | |||
| 30 | assert (lfs.chdir (upper), "could not change to upper directory") | 30 | assert (lfs.chdir (upper), "could not change to upper directory") |
| 31 | assert (lfs.chdir (reldir), "could not change back to current directory") | 31 | assert (lfs.chdir (reldir), "could not change back to current directory") |
| 32 | assert (lfs.currentdir() == current, "error trying to change directories") | 32 | assert (lfs.currentdir() == current, "error trying to change directories") |
| 33 | assert (lfs.chdir ("this couldn't be an actual directory") == false, "could change to a non-existent directory") | 33 | assert (lfs.chdir ("this couldn't be an actual directory") == nil, "could change to a non-existent directory") |
| 34 | -- Changing creating and removing directories | 34 | -- Changing creating and removing directories |
| 35 | assert (lfs.mkdir (tmp.."/lfs_tmp_dir"), "could not make a new directory") | 35 | assert (lfs.mkdir (tmp.."/lfs_tmp_dir"), "could not make a new directory") |
| 36 | assert (os.remove (tmp.."/lfs_tmp_dir"), "could not remove new directory") | 36 | assert (os.remove (tmp.."/lfs_tmp_dir"), "could not remove new directory") |
| 37 | assert (lfs.mkdir (tmp.."/lfs_tmp_dir/lfs_tmp_dir") == false, "could create a directory inside a non-existent one") | 37 | assert (lfs.mkdir (tmp.."/lfs_tmp_dir/lfs_tmp_dir") == false, "could create a directory inside a non-existent one") |
| 38 | -- | 38 | -- |
| 39 | assert (lfs.attributes ("this couldn't be an actual file") == false, "could get attributes of a non-existent file") | 39 | assert (lfs.attributes ("this couldn't be an actual file") == nil, "could get attributes of a non-existent file") |
| 40 | assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory") | 40 | assert (type(lfs.attributes (upper)) == "table", "couldn't get attributes of upper directory") |
