diff options
-rw-r--r-- | src/lfs.c | 23 |
1 files changed, 19 insertions, 4 deletions
@@ -16,7 +16,7 @@ | |||
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.54 2008/07/31 19:34:22 carregal Exp $ | 19 | ** $Id: lfs.c,v 1.55 2008/12/15 16:13:55 mascarenhas Exp $ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef _WIN32 | 22 | #ifndef _WIN32 |
@@ -27,6 +27,8 @@ | |||
27 | #endif | 27 | #endif |
28 | #endif | 28 | #endif |
29 | 29 | ||
30 | #define _LARGEFILE64_SOURCE | ||
31 | |||
30 | #include <errno.h> | 32 | #include <errno.h> |
31 | #include <stdio.h> | 33 | #include <stdio.h> |
32 | #include <string.h> | 34 | #include <string.h> |
@@ -38,7 +40,11 @@ | |||
38 | #include <direct.h> | 40 | #include <direct.h> |
39 | #include <io.h> | 41 | #include <io.h> |
40 | #include <sys/locking.h> | 42 | #include <sys/locking.h> |
41 | #include <sys/utime.h> | 43 | #ifdef __BORLANDC__ |
44 | #include <utime.h> | ||
45 | #else | ||
46 | #include <sys/utime.h> | ||
47 | #endif | ||
42 | #include <fcntl.h> | 48 | #include <fcntl.h> |
43 | #else | 49 | #else |
44 | #include <unistd.h> | 50 | #include <unistd.h> |
@@ -80,8 +86,13 @@ typedef struct dir_data { | |||
80 | 86 | ||
81 | 87 | ||
82 | #ifdef _WIN32 | 88 | #ifdef _WIN32 |
83 | #define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m)) | 89 | #ifdef __BORLANDC__ |
84 | #define STAT_STRUCT struct _stati64 | 90 | #define lfs_setmode(L,file,m) ((void)L, setmode(_fileno(file), m)) |
91 | #define STAT_STRUCT struct stati64 | ||
92 | #else | ||
93 | #define lfs_setmode(L,file,m) ((void)L, _setmode(_fileno(file), m)) | ||
94 | #define STAT_STRUCT struct _stati64 | ||
95 | #endif | ||
85 | #define STAT_FUNC _stati64 | 96 | #define STAT_FUNC _stati64 |
86 | #else | 97 | #else |
87 | #define _O_TEXT 0 | 98 | #define _O_TEXT 0 |
@@ -173,7 +184,11 @@ static int _file_lock (lua_State *L, FILE *fh, const char *mode, const long star | |||
173 | len = ftell (fh); | 184 | len = ftell (fh); |
174 | } | 185 | } |
175 | fseek (fh, start, SEEK_SET); | 186 | fseek (fh, start, SEEK_SET); |
187 | #ifdef __BORLANDC__ | ||
188 | code = locking (fileno(fh), lkmode, len); | ||
189 | #else | ||
176 | code = _locking (fileno(fh), lkmode, len); | 190 | code = _locking (fileno(fh), lkmode, len); |
191 | #endif | ||
177 | #else | 192 | #else |
178 | struct flock f; | 193 | struct flock f; |
179 | switch (*mode) { | 194 | switch (*mode) { |