Commit e27c9482 authored by andersca@apple.com's avatar andersca@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.


git-svn-id: svn://svn.chromium.org/blink/trunk@93420 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 316cb619
2011-08-18 Anders Carlsson <andersca@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 <benjamin@webkit.org>
[Qt][WK2] Add a basic engine to control the content of the viewport
......
......@@ -24,8 +24,9 @@
*/
#include <dlfcn.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/event.h>
#include <unistd.h>
static void closeUnusedFileDescriptors()
......@@ -33,8 +34,15 @@ static void closeUnusedFileDescriptors()
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment