Skip to content
Commit 0783b4f8 authored by Chris Down's avatar Chris Down Committed by Zbigniew Jędrzejewski-Szmek
Browse files

path: Improve $PATH search directory case

Previously:

1. last_error wouldn't be updated with errors from is_dir;
2. We'd always issue a stat(), even for binaries without execute;
3. We used stat() instead of access(), which is cheaper.

This change avoids all of those, by only checking inside X_OK-positive
case whether access() works on the path with an extra slash appended.
Thanks to Lennart for the suggestion.

(cherry picked from commit 33e1a5d8)
(cherry picked from commit a4236a27)
(cherry picked from commit 6a30d4e9)
parent d0735d81
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment