Lines 1-39
Link Here
|
1 |
--- es-core/src/utils/FileSystemUtil.cpp.orig 2020-11-29 11:37:59 UTC |
1 |
--- es-core/src/utils/FileSystemUtil.cpp.orig 2023-12-18 20:00:52 UTC |
2 |
+++ es-core/src/utils/FileSystemUtil.cpp |
2 |
+++ es-core/src/utils/FileSystemUtil.cpp |
3 |
@@ -577,10 +577,10 @@ namespace Utils |
3 |
@@ -578,10 +578,10 @@ namespace Utils |
4 |
bool exists(const std::string& _path) |
4 |
CloseHandle(hFile); |
5 |
{ |
5 |
} |
6 |
std::string path = getGenericPath(_path); |
6 |
#else // _WIN32 |
7 |
- struct stat64 info; |
7 |
- struct stat64 info; |
8 |
+ struct stat info; |
8 |
+ struct stat info; |
9 |
|
9 |
|
10 |
// check if stat64 succeeded |
10 |
- // check if lstat64 succeeded |
11 |
- return (stat64(path.c_str(), &info) == 0); |
11 |
- if(lstat64(path.c_str(), &info) == 0) |
12 |
+ return (stat(path.c_str(), &info) == 0); |
12 |
+ // check if lstat succeeded |
13 |
|
13 |
+ if(lstat(path.c_str(), &info) == 0) |
14 |
} // exists |
14 |
{ |
|
|
15 |
resolved.resize(info.st_size); |
16 |
if(readlink(path.c_str(), (char*)resolved.data(), resolved.size()) > 0) |
17 |
@@ -658,9 +658,9 @@ namespace Utils |
18 |
if(pathExistsIndex.find(_path) == pathExistsIndex.cend()) |
19 |
{ |
20 |
const std::string path = getGenericPath(_path); |
21 |
- struct stat64 info; |
22 |
- // check if stat64 succeeded |
23 |
- pathExistsIndex[_path] = (stat64(path.c_str(), &info) == 0); |
24 |
+ struct stat info; |
25 |
+ // check if stat succeeded |
26 |
+ pathExistsIndex[_path] = (stat(path.c_str(), &info) == 0); |
27 |
} |
15 |
|
28 |
|
16 |
@@ -599,10 +599,10 @@ namespace Utils |
29 |
return pathExistsIndex.at(_path); |
|
|
30 |
@@ -686,10 +686,10 @@ namespace Utils |
17 |
bool isRegularFile(const std::string& _path) |
31 |
bool isRegularFile(const std::string& _path) |
18 |
{ |
32 |
{ |
19 |
std::string path = getGenericPath(_path); |
33 |
const std::string path = getGenericPath(_path); |
|
|
34 |
- struct stat64 info; |
35 |
+ struct stat info; |
36 |
|
37 |
- // check if stat64 succeeded |
38 |
- if(stat64(path.c_str(), &info) != 0) |
39 |
+ // check if stat succeeded |
40 |
+ if(stat(path.c_str(), &info) != 0) |
41 |
return false; |
42 |
|
43 |
// check for S_IFREG attribute |
44 |
@@ -702,10 +702,10 @@ namespace Utils |
45 |
bool isDirectory(const std::string& _path) |
46 |
{ |
47 |
const std::string path = getGenericPath(_path); |
48 |
- struct stat64 info; |
49 |
+ struct stat info; |
50 |
|
51 |
- // check if stat64 succeeded |
52 |
- if(stat64(path.c_str(), &info) != 0) |
53 |
+ // check if stat succeeded |
54 |
+ if(stat(path.c_str(), &info) != 0) |
55 |
return false; |
56 |
|
57 |
// check for S_IFDIR attribute |
58 |
@@ -725,10 +725,10 @@ namespace Utils |
59 |
if((Attributes != INVALID_FILE_ATTRIBUTES) && (Attributes & FILE_ATTRIBUTE_REPARSE_POINT)) |
60 |
return true; |
61 |
#else // _WIN32 |
62 |
- struct stat64 info; |
63 |
+ struct stat info; |
64 |
|
65 |
- // check if lstat64 succeeded |
66 |
- if(lstat64(path.c_str(), &info) != 0) |
67 |
+ // check if lstat succeeded |
68 |
+ if(lstat(path.c_str(), &info) != 0) |
69 |
return false; |
70 |
|
71 |
// check for S_IFLNK attribute |
72 |
@@ -772,10 +772,10 @@ namespace Utils |
73 |
// regular files and executables, but not setuid, setgid, shared text |
74 |
const mode_t mask = S_IFREG; |
75 |
const mode_t mask_exec = S_IXUSR | S_IXGRP | S_IXOTH; |
20 |
- struct stat64 info; |
76 |
- struct stat64 info; |
21 |
+ struct stat info; |
77 |
+ struct stat info; |
22 |
|
78 |
|
23 |
// check if stat64 succeeded |
79 |
- // check if stat64 succeeded |
24 |
- if(stat64(path.c_str(), &info) != 0) |
80 |
- if(stat64(path.c_str(), &info) != 0) |
|
|
81 |
+ // check if stat succeeded |
25 |
+ if(stat(path.c_str(), &info) != 0) |
82 |
+ if(stat(path.c_str(), &info) != 0) |
26 |
return false; |
83 |
return false; |
27 |
|
84 |
|
28 |
// check for S_IFREG attribute |
85 |
// check for mask attributes |
29 |
@@ -670,8 +670,8 @@ namespace Utils |
|
|
30 |
} // isHidden |
31 |
#ifndef WIN32 // osx / linux |
32 |
bool isExecutable(const std::string& _path) { |
33 |
- struct stat64 st; |
34 |
- if(stat64(_path.c_str(), &st) == 0){ |
35 |
+ struct stat st; |
36 |
+ if(stat(_path.c_str(), &st) == 0){ |
37 |
mode_t perm = st.st_mode; |
38 |
// regular files and executables but not setuid, setgid, shared text (mode 0755) |
39 |
mode_t mask = S_IFREG | S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; |