From 4a1f2e0dd321f389131a6b29e3fedc6acd3bc74d Mon Sep 17 00:00:00 2001 From: cpq Date: Fri, 17 Feb 2023 10:36:06 +0000 Subject: [PATCH] Fix mg_fs_posix.st() for Windows symlinks using ftell --- mongoose.c | 2 +- src/fs_posix.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 4822059d..6cb77e29 100644 --- a/mongoose.c +++ b/mongoose.c @@ -1062,7 +1062,7 @@ static int p_stat(const char *path, size_t *size, time_t *mtime) { FILE *fp = _wfopen(tmp, L"rb"); if (fp != NULL) { fseek(fp, 0, SEEK_END); - if (_ftelli64(fp) > 0) st.st_size = _ftelli64(fp); + if (ftell(fp) > 0) st.st_size = ftell(fp); // Use _ftelli64 on win10+ fclose(fp); } } diff --git a/src/fs_posix.c b/src/fs_posix.c index a3fc0e3f..280d84ef 100644 --- a/src/fs_posix.c +++ b/src/fs_posix.c @@ -26,7 +26,7 @@ static int p_stat(const char *path, size_t *size, time_t *mtime) { FILE *fp = _wfopen(tmp, L"rb"); if (fp != NULL) { fseek(fp, 0, SEEK_END); - if (_ftelli64(fp) > 0) st.st_size = _ftelli64(fp); + if (ftell(fp) > 0) st.st_size = ftell(fp); // Use _ftelli64 on win10+ fclose(fp); } }