[*] More POSIX bugs

This commit is contained in:
Reece Wilson 2023-09-20 21:13:43 +01:00
parent 4fa053ce97
commit 7bc533b710

View File

@ -67,7 +67,7 @@ namespace Aurora::IO::FS
mode_t mode { 0644 }; mode_t mode { 0644 };
struct stat s; struct stat s;
if (::stat(srcPath.c_str(), &s) < 0) if (::stat(srcPath.c_str(), &s) == 0)
{ {
mode = s.st_mode; mode = s.st_mode;
mode &= ~( 0111 ); mode &= ~( 0111 );
@ -95,7 +95,7 @@ namespace Aurora::IO::FS
mode_t mode { 0644 }; mode_t mode { 0644 };
struct stat s; struct stat s;
if (::stat(srcPath.c_str(), &s) < 0) if (::stat(srcPath.c_str(), &s) == 0)
{ {
mode = s.st_mode; mode = s.st_mode;
mode &= ~(0111); mode &= ~(0111);
@ -121,7 +121,7 @@ namespace Aurora::IO::FS
return {}; return {};
} }
if (::stat(srcPath.c_str(), &s) < 0) if (::stat(srcPath.c_str(), &s) == 0)
{ {
mode = s.st_mode; mode = s.st_mode;
mode |= 0111; mode |= 0111;
@ -170,7 +170,7 @@ namespace Aurora::IO::FS
return {}; return {};
} }
if (::stat(srcPath.c_str(), &s) < 0) if (::stat(srcPath.c_str(), &s) == 0)
{ {
return (s.st_mode & 0111) != 0; return (s.st_mode & 0111) != 0;
} }