| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Dynamically size getcwd() buffer in get_dir function
This should fix issue 42.
* Fixup: Properly respect NO_GETCWD
* Fixup: Get rid of getcwd_error, handle NO_GETCWD in a single place
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When the second argument is not a string, _file_info() wants to
ensure that there is a table on top of the stack: the second argument
or a new table. If a new table is pushed it's created on top immediately,
but if a table is passed as the second argument it can be followed
by extra arguments, with the last one ending up being used as a table,
causing a crash. The fix is to remove any potential extra arguments
using `lua_settop(L, 2)`.
Also added a few tests for this case. Ref #80.
|
| |
| |
| |
| |
| |
| |
| | |
It returns the resolved path of the symlink.
Original version by Hisham <hisham@gobolinux.org>, modified to
use a different strategy for sizing the readlink() buffer.
|
| |
| |
| |
| | |
* Make lfs export luaopen_lfs under Windows
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
| |
Change pushresult() to return true on success.
Change make_link to keep returning 0.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
About indentation: currently parts of lfs.c use 2 spaces
and parts use 8. It would be nice to slowly switch to one
of styles over some time, as code is being touched here and there.
2 spaces seem preferrable as it's what Lua itself uses.
|
| |
|
| |
|
|\
| |
| | |
Minor refactoring of setmode
|
| | |
|
| | |
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
The pushresult(L, -1, ...) call will delegate to pusherror() anyway,
but this avoids the "Unused static" warning for pushresult.
Also take care of assigning something meaningful to `errno`, as
strerror(errno) is used for constructing the Lua error message.
Fixes #65
|
|
|
|
|
|
|
|
|
| |
Lua 5.2 changed the protocol on how to represent closed files: Lua 5.1
sets the file pointer to NULL, Lua 5.2 sets the close function pointer
to NULL (a NULL file pointer now signals an incompletely constructed
object).
Also `luaL_checkudata` never returns NULL, it raises an error instead
if you have an invalid value (no userdata/not correct userdata type).
|
|\ |
|
| |
| |
| |
| | |
code
|
| | |
|
|/ |
|
|
|
|
| |
extra null byte off of const string (windows only).
|
|\
| |
| | |
Add. Travis files.
|
| | |
|
|/
|
| |
Which disables LARGE_FILE support
|
| |
|
|
|
|
|
|
|
| |
fs.attributes(file, 'blksize') and fs.attributes(file, 'blocks) return
the wrong values.
Compare the whole attribute name instead of the first char and remove
buggy special casing with wrong indexes into the member array.
|
|
|
|
|
|
|
|
| |
lfs_unlock_dir can be called multiple times for the same object.
For example if lock:free is called manually.
Then lfs_unlock_dir will be called always
again, as soon as the LOCK_METATABLE is collected by GC.
This can lead to strange file errors later on, like closing
another file, which now has been assigned the same handle...
|
|
|
| |
Tested on MS VS2008(x32) MinGW(x32) and MS VS2012(x64)
|
|
|
| |
Fix Windows build: make_link now returns int as it should
|
|\
| |
| | |
Fix some warnings GCC produced on Linux
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
On non-win32 lfs_setmode was defined to 0, ignoring all parameters.
Now the parameters are explicitly discarded.
Fixes:
src/lfs.c: In function ‘lfs_g_setmode’:
src/lfs.c:324:7: warning: unused variable ‘op’ [-Wunused-variable]
src/lfs.c:321:47: warning: unused parameter ‘f’ [-Wunused-parameter]
|
| | |
|
| |
| |
| |
| |
| | |
* Ensures backward compatibility with LFS 1.5
* Module name is defined as LFS_LIBNAME, similar to how Lua standard libraries are defined
|
| |
| |
| |
| | |
better visible
|
|/ |
|
| |
|
| |
|
|\
| |
| | |
Improvements to use of getcwd() for using the correct max path length
|
| |
| |
| |
| |
| |
| | |
changed to call to getcwd to specify a buffer and explicit size which successfully works around the problem. One minor performance advantage is that one less malloc/free is needed since the buffer is now created on the stack. Apparently, this was already changed in a prior commit I didn't see initially, but I think the use of an invented/arbitrary PATH_MAX is incorrect. Platforms should generally provide a constant for this and PATH_MAX itself is already defined on some systems like Linux which can cause collisions. This commit improves on those changes by leveraging the constants provided by the compiler/system.
To help keep the code consistent but still correct, new platform specific code needed to be introduced for the max length. On POSIX I am assuming it is that <sys/param.h> provides MAXPATHLEN. This is what the Mac/BSD man page says to use and verified this is also defined on Ubuntu Linux and Android. On Windows, MAX_PATH is used. MAX_PATH seems to still be 260 which seems kind of small; is there a different constant we are supposed to use? In both cases, the respective constants are mapped to a new #define for LFS_MAXPATHLEN to allow the code to refer to one constant and avoid any potential name collisions in case MAXPATHLEN is defined already by something else on Windows (e.g. Cygwin).
|
|\ \
| |/
|/| |
5.2 compatibility
|
| | |
|
|/ |
|
| |
|