diff options
-rw-r--r-- | src/lfs.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -16,12 +16,13 @@ | |||
16 | ** lfs.touch (filepath [, atime [, mtime]]) | 16 | ** lfs.touch (filepath [, atime [, mtime]]) |
17 | ** lfs.unlock (fh) | 17 | ** lfs.unlock (fh) |
18 | ** | 18 | ** |
19 | ** $Id: lfs.c,v 1.47 2008/02/11 22:42:21 carregal Exp $ | 19 | ** $Id: lfs.c,v 1.48 2008/02/18 03:13:50 mascarenhas Exp $ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <errno.h> | 22 | #include <errno.h> |
23 | #include <stdio.h> | 23 | #include <stdio.h> |
24 | #include <string.h> | 24 | #include <string.h> |
25 | #include <stdlib.h> | ||
25 | #include <time.h> | 26 | #include <time.h> |
26 | #include <sys/stat.h> | 27 | #include <sys/stat.h> |
27 | 28 | ||
@@ -176,7 +177,7 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star | |||
176 | return (code != -1); | 177 | return (code != -1); |
177 | } | 178 | } |
178 | 179 | ||
179 | 180 | #ifdef _WIN32 | |
180 | static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { | 181 | static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { |
181 | static const int mode[] = {_O_TEXT, _O_BINARY}; | 182 | static const int mode[] = {_O_TEXT, _O_BINARY}; |
182 | static const char *const modenames[] = {"text", "binary", NULL}; | 183 | static const char *const modenames[] = {"text", "binary", NULL}; |
@@ -206,6 +207,7 @@ static int lfs_g_setmode (lua_State *L, FILE *f, int arg) { | |||
206 | static int lfs_f_setmode(lua_State *L) { | 207 | static int lfs_f_setmode(lua_State *L) { |
207 | return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2); | 208 | return lfs_g_setmode(L, check_file(L, 1, "setmode"), 2); |
208 | } | 209 | } |
210 | #endif | ||
209 | 211 | ||
210 | /* | 212 | /* |
211 | ** Locks a file. | 213 | ** Locks a file. |
@@ -528,6 +530,7 @@ static void push_st_blksize (lua_State *L, struct stat *info) { | |||
528 | #endif | 530 | #endif |
529 | static void push_invalid (lua_State *L, struct stat *info) { | 531 | static void push_invalid (lua_State *L, struct stat *info) { |
530 | luaL_error(L, "invalid attribute name"); | 532 | luaL_error(L, "invalid attribute name"); |
533 | info->st_blksize = 0; /* never reached */ | ||
531 | } | 534 | } |
532 | 535 | ||
533 | typedef void (*_push_function) (lua_State *L, struct stat *info); | 536 | typedef void (*_push_function) (lua_State *L, struct stat *info); |
@@ -642,7 +645,7 @@ static const struct luaL_reg fslib[] = { | |||
642 | #ifndef _WIN32 | 645 | #ifndef _WIN32 |
643 | {"symlinkattributes", link_info}, | 646 | {"symlinkattributes", link_info}, |
644 | #else | 647 | #else |
645 | {"setmode", lfs_f_setmode}, | 648 | {"setmode", lfs_f_setmode}, |
646 | #endif | 649 | #endif |
647 | {"touch", file_utime}, | 650 | {"touch", file_utime}, |
648 | {"unlock", file_unlock}, | 651 | {"unlock", file_unlock}, |