2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-14 15:47:54 +03:00

Use stat64 for better compatibility

This commit is contained in:
asmodai 2017-07-21 15:12:55 +03:00
parent db11f9830b
commit 7ffbf8f826
3 changed files with 7 additions and 6 deletions

View File

@ -1088,9 +1088,9 @@ void MPlugin::show()
// last loaded the plugin. // last loaded the plugin.
bool MPlugin::newer_file() const bool MPlugin::newer_file() const
{ {
struct stat st; struct stat64 st;
if (stat(m_pathname, &st) != 0) { if (stat64(m_pathname, &st) != 0) {
META_ERROR("ini: Skipping plugin, couldn't stat file '%s': %s", m_pathname, strerror(errno)); META_ERROR("ini: Skipping plugin, couldn't stat file '%s': %s", m_pathname, strerror(errno));
return false; return false;
} }

View File

@ -73,6 +73,7 @@ private:
#elif defined(_WIN32) #elif defined(_WIN32)
#define snprintf _snprintf #define snprintf _snprintf
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define stat64 _stat64
#define sleep(x) Sleep(x*1000) #define sleep(x) Sleep(x*1000)
#include <io.h> #include <io.h>
#define open _open #define open _open

View File

@ -171,8 +171,8 @@ bool is_abs_path(const char* path)
bool is_valid_path(const char* path) bool is_valid_path(const char* path)
{ {
struct stat st; struct stat64 st;
return !stat(path, &st) && S_ISREG(st.st_mode); return !stat64(path, &st) && S_ISREG(st.st_mode);
} }
bool is_platform_postfix(const char* pf) bool is_platform_postfix(const char* pf)
@ -242,8 +242,8 @@ bool is_file_exists_in_gamedir(const char* path)
else else
snprintf(buf, sizeof buf, "%s/%s", g_GameDLL.gamedir, path); snprintf(buf, sizeof buf, "%s/%s", g_GameDLL.gamedir, path);
struct stat st; struct stat64 st;
int ret = stat(buf, &st); int ret = stat64(buf, &st);
if (ret != 0) { if (ret != 0) {
META_DEBUG(5, "Unable to stat '%s': %s", buf, strerror(errno)); META_DEBUG(5, "Unable to stat '%s': %s", buf, strerror(errno));
return false; return false;