Fix mg_fs_posix.st() for Windows symlinks using ftell

This commit is contained in:
cpq 2023-02-17 10:36:06 +00:00
parent 24e3514640
commit 4a1f2e0dd3
2 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}