diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-28 13:59:05 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-28 13:59:05 -0400 |
| commit | c70b11f01e71cd4443b8ee904f439a66b9b48b20 (patch) | |
| tree | b8b8e6d1fb1952e5005a2232c990b438e1ab9829 /src/stdlib | |
| parent | e6c361568181b5ff952a72b08897033981910147 (diff) | |
Compatibility fix for euidaccess
Diffstat (limited to 'src/stdlib')
| -rw-r--r-- | src/stdlib/paths.c | 12 |
1 files changed, 12 insertions, 0 deletions
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) |
