mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-20 19:41:58 +00:00
Fail stat() if S_ISDIR is not defined
This commit is contained in:
1 parent
e9fc3fcecf
commit
ce6164ca20
1 file changed
+6
-1
+6
-1
@@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
#if MG_ENABLE_FILE
|
#if MG_ENABLE_FILE
|
||||||
static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
||||||
#ifdef _WIN32
|
#if !defined(S_ISDIR)
|
||||||
|
LOG(LL_ERROR, ("stat() API is not supported. %p %p %p", path, size, mtime));
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
#if defined(_WIN32)
|
||||||
struct _stati64 st;
|
struct _stati64 st;
|
||||||
wchar_t tmp[PATH_MAX];
|
wchar_t tmp[PATH_MAX];
|
||||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, tmp, sizeof(tmp) / sizeof(tmp[0]));
|
MultiByteToWideChar(CP_UTF8, 0, path, -1, tmp, sizeof(tmp) / sizeof(tmp[0]));
|
||||||
@@ -14,6 +18,7 @@ static int p_stat(const char *path, size_t *size, time_t *mtime) {
|
|||||||
if (size) *size = (size_t) st.st_size;
|
if (size) *size = (size_t) st.st_size;
|
||||||
if (mtime) *mtime = st.st_mtime;
|
if (mtime) *mtime = st.st_mtime;
|
||||||
return MG_FS_READ | MG_FS_WRITE | (S_ISDIR(st.st_mode) ? MG_FS_DIR : 0);
|
return MG_FS_READ | MG_FS_WRITE | (S_ISDIR(st.st_mode) ? MG_FS_DIR : 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|||||||
Reference in new issue
Block a user