Skip to content

Commit 45aecae

Browse files
committed
Util (Linux): fix executable file check
1 parent 3d3669a commit 45aecae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/util/path.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const char* ffFindExecutableInPath(const char* name, FFstrbuf* result)
3838
if (!ffPathExists(result->chars, FF_PATHTYPE_FILE))
3939
continue;
4040
#else
41-
struct stat st;
42-
if (stat(result->chars, &st) < 0 || !(st.st_mode & S_IXUSR))
41+
if (access(result->chars, X_OK) != 0)
4342
continue;
4443
#endif
4544

@@ -52,7 +51,8 @@ const char* ffFindExecutableInPath(const char* name, FFstrbuf* result)
5251
bool ffIsAbsolutePath(const char* path)
5352
{
5453
#ifdef _WIN32
55-
return ffCharIsEnglishAlphabet(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/');
54+
return (ffCharIsEnglishAlphabet(path[0]) && path[1] == ':' && (path[2] == '\\' || path[2] == '/')) // drive letter path
55+
|| (path[0] == '\\' && path[1] == '\\'); // UNC path
5656
#else
5757
return path[0] == '/';
5858
#endif

0 commit comments

Comments
 (0)