aboutsummaryrefslogtreecommitdiff
path: root/src/which.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-28 03:04:30 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-28 03:04:30 -0800
commit70a56028b62a2645d436e21b9731cf8fe3f12dd4 (patch)
treee0d08a3cee1c41ac8b48a3b84de276c631fe7cf2 /src/which.zig
parent08327e27486464bec9680404de2fe9e726534602 (diff)
downloadbun-70a56028b62a2645d436e21b9731cf8fe3f12dd4.tar.gz
bun-70a56028b62a2645d436e21b9731cf8fe3f12dd4.tar.zst
bun-70a56028b62a2645d436e21b9731cf8fe3f12dd4.zip
use c-like functionsbun-v0.0.61
Diffstat (limited to 'src/which.zig')
-rw-r--r--src/which.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/which.zig b/src/which.zig
index 71120f3d1..50c82c05d 100644
--- a/src/which.zig
+++ b/src/which.zig
@@ -10,7 +10,7 @@ fn isValid(buf: *[std.fs.MAX_PATH_BYTES]u8, segment: []const u8, bin: []const u8
// we cannot use access() here even though all we want to do now here is check it is executable
// directories can be considered executable
if (std.c.stat(filepath, &stat) != 0) return null;
- if (stat.mode & std.os.S_IXUSR == 0 or (stat.mode & std.os.S_IFREG == 0 and stat.mode & std.os.S_ISLNK == 0)) return null;
+ if (stat.mode & std.os.S_IXUSR == 0 or !(std.os.S_ISLNK(stat.mode) or std.os.S_ISREG(stat.mode))) return null;
return @intCast(u16, filepath.len);
}