diff options
| author | mascarenhas <mascarenhas> | 2008-01-16 22:29:26 +0000 |
|---|---|---|
| committer | mascarenhas <mascarenhas> | 2008-01-16 22:29:26 +0000 |
| commit | 895e9daf27c7e8dcfd5c4d7f5cf1b8edf20b6e11 (patch) | |
| tree | 1c3460092c765850085a52f1fd5f9023f21e6699 | |
| parent | 50f17597b39ff746b5dcc45b7b4962e1483b308f (diff) | |
| download | luafilesystem-895e9daf27c7e8dcfd5c4d7f5cf1b8edf20b6e11.tar.gz luafilesystem-895e9daf27c7e8dcfd5c4d7f5cf1b8edf20b6e11.tar.bz2 luafilesystem-895e9daf27c7e8dcfd5c4d7f5cf1b8edf20b6e11.zip | |
getcwd no longer passes a buffer
| -rw-r--r-- | rockspecs/luafilesystem-1.3.0-1.rockspec | 27 | ||||
| -rw-r--r-- | rockspecs/luafilesystem-cvs-1.rockspec | 23 | ||||
| -rw-r--r-- | src/lfs.c | 23 |
3 files changed, 62 insertions, 11 deletions
diff --git a/rockspecs/luafilesystem-1.3.0-1.rockspec b/rockspecs/luafilesystem-1.3.0-1.rockspec new file mode 100644 index 0000000..d4d484f --- /dev/null +++ b/rockspecs/luafilesystem-1.3.0-1.rockspec | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | package = "LuaFileSystem" | ||
| 2 | version = "1.3.0-1" | ||
| 3 | source = { | ||
| 4 | url = "http://luaforge.net/frs/download.php/2679/luafilesystem-1.3.0.tar.gz" | ||
| 5 | } | ||
| 6 | description = { | ||
| 7 | summary = "File System Library for the Lua Programming Language", | ||
| 8 | detailed = [[ | ||
| 9 | LuaFileSystem is a Lua library developed to complement the set of | ||
| 10 | functions related to file systems offered by the standard Lua | ||
| 11 | distribution. LuaFileSystem offers a portable way to access the | ||
| 12 | underlying directory structure and file attributes. | ||
| 13 | ]] | ||
| 14 | } | ||
| 15 | dependencies = { | ||
| 16 | "lua >= 5.1" | ||
| 17 | } | ||
| 18 | build = { | ||
| 19 | type = "make", | ||
| 20 | build_variables = { | ||
| 21 | LUA_INC = "$(LUA_INCDIR)", | ||
| 22 | LIB_OPTION = "$(LIBFLAG)" | ||
| 23 | }, | ||
| 24 | install_variables = { | ||
| 25 | LUA_LIBDIR = "$(LIBDIR)" | ||
| 26 | } | ||
| 27 | } | ||
diff --git a/rockspecs/luafilesystem-cvs-1.rockspec b/rockspecs/luafilesystem-cvs-1.rockspec new file mode 100644 index 0000000..686c6f9 --- /dev/null +++ b/rockspecs/luafilesystem-cvs-1.rockspec | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | package = "LuaFileSystem" | ||
| 2 | version = "cvs-1" | ||
| 3 | source = { | ||
| 4 | url = "cvs://:pserver:anonymous:@cvs.luaforge.net:/cvsroot/luafilesystem" | ||
| 5 | } | ||
| 6 | description = { | ||
| 7 | summary = "File System Library for the Lua Programming Language", | ||
| 8 | detailed = [[ | ||
| 9 | LuaFileSystem is a Lua library developed to complement the set of | ||
| 10 | functions related to file systems offered by the standard Lua | ||
| 11 | distribution. LuaFileSystem offers a portable way to access the | ||
| 12 | underlying directory structure and file attributes. | ||
| 13 | ]] | ||
| 14 | } | ||
| 15 | dependencies = { | ||
| 16 | "lua >= 5.1" | ||
| 17 | } | ||
| 18 | build = { | ||
| 19 | type = "module", | ||
| 20 | modules = { | ||
| 21 | lfs = "lfs.c" | ||
| 22 | } | ||
| 23 | } | ||
| @@ -15,7 +15,7 @@ | |||
| 15 | ** lfs.touch (filepath [, atime [, mtime]]) | 15 | ** lfs.touch (filepath [, atime [, mtime]]) |
| 16 | ** lfs.unlock (fh) | 16 | ** lfs.unlock (fh) |
| 17 | ** | 17 | ** |
| 18 | ** $Id: lfs.c,v 1.43 2007/12/22 17:19:45 mascarenhas Exp $ | 18 | ** $Id: lfs.c,v 1.44 2008/01/16 22:29:26 mascarenhas Exp $ |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <errno.h> | 21 | #include <errno.h> |
| @@ -100,16 +100,17 @@ static int change_dir (lua_State *L) { | |||
| 100 | ** and a string describing the error | 100 | ** and a string describing the error |
| 101 | */ | 101 | */ |
| 102 | static int get_dir (lua_State *L) { | 102 | static int get_dir (lua_State *L) { |
| 103 | char path[255+2]; | 103 | char *path; |
| 104 | if (getcwd(path, 255) == NULL) { | 104 | if ((path = getcwd(NULL, 0)) == NULL) { |
| 105 | lua_pushnil(L); | 105 | lua_pushnil(L) |
| 106 | lua_pushstring(L, getcwd_error); | 106 | lua_pushstring(L, getcwd_error); |
| 107 | return 2; | 107 | return 2; |
| 108 | } | 108 | } |
| 109 | else { | 109 | else { |
| 110 | lua_pushstring(L, path); | 110 | lua_pushstring(L, path); |
| 111 | return 1; | 111 | free(path); |
| 112 | } | 112 | return 1; |
| 113 | } | ||
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | /* | 116 | /* |
