[darwinbuild-changes] [255] trunk/darwintrace/darwintrace.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 4 02:02:01 PDT 2006


Revision: 255
          http://trac.macosforge.org/projects/darwinbuild/changeset/255
Author:   ssen
Date:     2006-10-04 02:02:01 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
override close and prevent a process from closing darwintrace's log fd

Modified Paths:
--------------
    trunk/darwintrace/darwintrace.c

Modified: trunk/darwintrace/darwintrace.c
===================================================================
--- trunk/darwintrace/darwintrace.c	2005-09-16 03:03:53 UTC (rev 254)
+++ trunk/darwintrace/darwintrace.c	2006-10-04 09:02:01 UTC (rev 255)
@@ -349,3 +349,17 @@
 	result = execve(path, argv, envp);
 	return result;
 }
+
+/* if darwintrace has  been initialized, trap
+   attempts to close our file descriptor
+*/
+int close(int fd) {
+#define close(x) syscall(SYS_close, (x))
+
+  if(__darwintrace_fd != -2 && fd == __darwintrace_fd) {
+    errno = EBADF;
+    return -1;
+  }
+
+  return close(fd);
+}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/e190b9e3/attachment-0001.html


More information about the darwinbuild-changes mailing list