Title: [93420] trunk/Source/WebKit2
- Revision
- 93420
- Author
- ander...@apple.com
- Date
- 2011-08-19 09:22:29 -0700 (Fri, 19 Aug 2011)
Log Message
WebProcess crashes during startup if libdispatch is initialized by WebProcessShim.dylib
https://bugs.webkit.org/show_bug.cgi?id=66508
<rdar://problem/9828476>
Reviewed by Mark Rowe.
* mac/MainMac.cpp:
(closeUnusedFileDescriptors):
Check if a file descriptor is a kqueue and don't close it if that is the case. While this
isn't a complete fix, (it won't work if other initializers end up creating non-kqueue file descriptors)
it's good enough for Snow Leopard. For Lion, we should use the new posix_spawn API that lets you whitelist
file descriptors from the parent process.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (93419 => 93420)
--- trunk/Source/WebKit2/ChangeLog 2011-08-19 16:17:40 UTC (rev 93419)
+++ trunk/Source/WebKit2/ChangeLog 2011-08-19 16:22:29 UTC (rev 93420)
@@ -1,3 +1,18 @@
+2011-08-18 Anders Carlsson <ander...@apple.com>
+
+ WebProcess crashes during startup if libdispatch is initialized by WebProcessShim.dylib
+ https://bugs.webkit.org/show_bug.cgi?id=66508
+ <rdar://problem/9828476>
+
+ Reviewed by Mark Rowe.
+
+ * mac/MainMac.cpp:
+ (closeUnusedFileDescriptors):
+ Check if a file descriptor is a kqueue and don't close it if that is the case. While this
+ isn't a complete fix, (it won't work if other initializers end up creating non-kqueue file descriptors)
+ it's good enough for Snow Leopard. For Lion, we should use the new posix_spawn API that lets you whitelist
+ file descriptors from the parent process.
+
2011-08-19 Benjamin Poulain <benja...@webkit.org>
[Qt][WK2] Add a basic engine to control the content of the viewport
Modified: trunk/Source/WebKit2/mac/MainMac.cpp (93419 => 93420)
--- trunk/Source/WebKit2/mac/MainMac.cpp 2011-08-19 16:17:40 UTC (rev 93419)
+++ trunk/Source/WebKit2/mac/MainMac.cpp 2011-08-19 16:22:29 UTC (rev 93420)
@@ -24,8 +24,9 @@
*/
#include <dlfcn.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <stdio.h>
+#include <sys/event.h>
#include <unistd.h>
static void closeUnusedFileDescriptors()
@@ -33,8 +34,15 @@
int numFDs = getdtablesize();
// Close all file descriptors except stdin, stdout and stderr.
- for (int fd = 3; fd < numFDs; ++fd)
+ for (int fd = 3; fd < numFDs; ++fd) {
+ // Check if this is a kqueue file descriptor. If it is, we don't want to close it because it has
+ // been created by initializing libdispatch from a global initializer. See <rdar://problem/9828476> for more details.
+ struct timespec timeSpec = { 0, 0 };
+ if (!kevent(fd, 0, 0, 0, 0, &timeSpec))
+ continue;
+
close(fd);
+ }
}
int main(int argc, char** argv)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes