mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-29 13:30:32 +01:00
Only detect binaries with execution permission
If for instance a program was in PATH and the file was marked non-executable (`chmod -x`), `find_binary` it would still pick it up as executable.
This commit is contained in:
parent
c6b190734f
commit
78a1de612e
@ -496,12 +496,12 @@ def find_binary(self, filenames, exts, paths):
|
||||
for ext in exts:
|
||||
exe_name = f + ext
|
||||
if os.path.isabs(exe_name):
|
||||
if os.path.isfile(exe_name):
|
||||
if os.path.isfile(exe_name) and os.access(x, os.X_OK):
|
||||
return exe_name
|
||||
else:
|
||||
for path in paths:
|
||||
x = os.path.expanduser(os.path.join(path, exe_name))
|
||||
if os.path.isfile(x):
|
||||
if os.path.isfile(x) and os.access(x, os.X_OK):
|
||||
return x
|
||||
return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user