[108468] trunk/base/src/darwintracelib1.0/darwintrace.c

cal at macports.org cal at macports.org
Tue Jul 23 14:58:16 PDT 2013


Revision: 108468
          https://trac.macports.org/changeset/108468
Author:   cal at macports.org
Date:     2013-07-23 14:58:15 -0700 (Tue, 23 Jul 2013)
Log Message:
-----------
darwintrace: don't hide directories in access(2), different solution for the problem of missing '/'

Modified Paths:
--------------
    trunk/base/src/darwintracelib1.0/darwintrace.c

Modified: trunk/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- trunk/base/src/darwintracelib1.0/darwintrace.c	2013-07-23 21:46:59 UTC (rev 108467)
+++ trunk/base/src/darwintracelib1.0/darwintrace.c	2013-07-23 21:58:15 UTC (rev 108468)
@@ -912,10 +912,6 @@
 		strcat(normalizedpath, "/");
 	}
 
-	if (strcmp("/", normalizedpath) == 0) {
-		/* always allow '/' */
-		return 1;
-	}
 	for (__darwintrace_filemap_iterator_init(&filemap_it);
 	        (t = __darwintrace_filemap_iter(&command, &replacementpath, &filemap_it));) {
 		if (__darwintrace_pathbeginswith(normalizedpath, t)) {
@@ -1460,10 +1456,20 @@
 
 int access(const char *path, int amode) {
 #define access(x, y) syscall(SYS_access, (x), (y))
+#define lstat(path, sb) syscall(SYS_lstat, path, sb)
+	struct stat st;
 	char newpath[MAXPATHLEN];
 
 	debug_printf("access(%s, %d)\n", path, amode);
 
+	if (-1 == (result = lstat(path, &st))) {
+		return -1;
+	}
+
+	if (S_ISDIR(st.st_mode)) {
+		return access(path, amode);
+	}
+
 	*newpath = '\0';
 	if (!__darwintrace_is_in_sandbox(path, newpath)) {
 		errno = ENOENT;
@@ -1475,6 +1481,7 @@
 	}
 
 	return access(path, amode);
+#undef lstat
 #undef access
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130723/6cf4f7ef/attachment.html>


More information about the macports-changes mailing list