aboutsummaryrefslogtreecommitdiffstats
path: root/ports/unix/guts/access.c
diff options
context:
space:
mode:
Diffstat (limited to 'ports/unix/guts/access.c')
-rw-r--r--ports/unix/guts/access.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/ports/unix/guts/access.c b/ports/unix/guts/access.c
new file mode 100644
index 0000000..5a92957
--- /dev/null
+++ b/ports/unix/guts/access.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010 Wind River Systems; see
+ * guts/COPYRIGHT for information.
+ *
+ * static int
+ * wrap_access(const char *path, int mode) {
+ * int rc = -1;
+ */
+ struct stat buf;
+
+ /* note: no attempt to handle the case where user isn't
+ * root.
+ */
+ rc = real_stat(path, &buf);
+ 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;
+ * }
+ */