Using F_SETFL to set the FD_CLOEXEC flag in the following code is wrong, the correct command here is F_SETFD. while (fcntl(fileDescriptors[i], F_SETFL, FD_CLOEXEC) == -1) { if (errno != EINTR) { ASSERT_NOT_REACHED(); break; } }
Created attachment 222579 [details] Patch
Nice catch! After a quick look, SharedMemory::createHandle() [WebKit2/Platform/unix/SharedMemoryUnix.cpp] seems suspicious, as in it does fcntl(duplicatedHandle, F_SETFD, FD_CLOEXEC | accessModeFile(protection)) == -1). Seems like it should be F_SETFD for FD_CLOEXEC and F_SETFL for the access mode (O_RDONLY or O_RDWR, in this case), no?
I think you're right, I'll update the patch.
Created attachment 222804 [details] Patch
Comment on attachment 222804 [details] Patch Would be much better if these had test coverage.
Committed r163292: <http://trac.webkit.org/changeset/163292>