diff options
| author | Jakob Kaivo <jkk@ung.org> | 2024-01-31 16:44:28 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2024-01-31 16:44:28 -0500 |
| commit | 2bc46bd54cc8cdcd7647461f2d76384266f2a0e4 (patch) | |
| tree | 52b77d68abbe5f971f63d2c82df8e933b831b521 /src/unistd/access.c | |
| parent | a05e8f1436eecb990d68bc1de8ba28721f1f387d (diff) | |
remove unistd
Diffstat (limited to 'src/unistd/access.c')
| -rw-r--r-- | src/unistd/access.c | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/unistd/access.c b/src/unistd/access.c deleted file mode 100644 index 0cbf81d4..00000000 --- a/src/unistd/access.c +++ /dev/null @@ -1,48 +0,0 @@ -#if 0 - -#include <stddef.h> -#include <sys/types.h> -#include <unistd.h> -#include <errno.h> -#include <sys/stat.h> - -int access(const char *path, int amode) -{ - struct stat st; - mode_t check = (amode & R_OK ? 4 : 0) - | (amode & W_OK ? 2 : 0) - | (amode & X_OK ? 1 : 0); - - if (amode != F_OK && ((amode & ~(R_OK | W_OK | X_OK)) != 0)) { - errno = EINVAL; - return -1; - } - - if (stat(path, &st) == -1) { - /* errno set by stat() */ - return -1; - } - - if (amode == F_OK) { - return 0; - } - - if (st.st_uid == getuid()) { - check <<= 6; - } else if (st.st_gid == getgid()) { - check <<= 3; - } - - if ((st.st_mode & check) == check) { - return 0; - } - - errno = EACCES; - return -1; -} -/* -POSIX(1) -*/ - - -#endif |
