aboutsummaryrefslogtreecommitdiffstats
path: root/guts/access.c
blob: 761ae66d1c5083d64888dd6554fba0910c8e1cca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* 
 * static int
 * wrap_access(const char *path, int mode) {
 *	int rc = -1;
 */
	struct stat64 buf;

	/* note:  no attempt to handle the case where user isn't
	 * root.
	 */
	rc = wrap___fxstatat64(_STAT_VER, AT_FDCWD, path, &buf, 0);
	if (rc == -1)
		return rc;

	if (mode & X_OK) {
		if (buf.st_mode & 0111) {
			return 0;
		} else {
			errno = EPERM;
			return -1;
		}
	} else {
		return 0;
	}

/*	return rc;
 * }
 */