From c70b11f01e71cd4443b8ee904f439a66b9b48b20 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 28 Mar 2025 13:59:05 -0400 Subject: Compatibility fix for euidaccess --- src/stdlib/paths.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c index 83e480e1..7a4df182 100644 --- a/src/stdlib/paths.c +++ b/src/stdlib/paths.c @@ -226,21 +226,33 @@ public bool Path$can_read(Path_t path) { path = Path$expand_home(path); const char *path_str = Path$as_c_string(path); +#ifdef _GNU_SOURCE return (euidaccess(path_str, R_OK) == 0); +#else + return (access(path_str, R_OK) == 0); +#endif } public bool Path$can_write(Path_t path) { path = Path$expand_home(path); const char *path_str = Path$as_c_string(path); +#ifdef _GNU_SOURCE return (euidaccess(path_str, W_OK) == 0); +#else + return (access(path_str, W_OK) == 0); +#endif } public bool Path$can_execute(Path_t path) { path = Path$expand_home(path); const char *path_str = Path$as_c_string(path); +#ifdef _GNU_SOURCE return (euidaccess(path_str, X_OK) == 0); +#else + return (access(path_str, X_OK) == 0); +#endif } public OptionalMoment_t Path$modified(Path_t path, bool follow_symlinks) -- cgit v1.2.3