| Summary: | Fix wrong mix of fcntl commands and flags | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Alberto Garcia <berto> | ||||||
| Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> | ||||||
| Status: | RESOLVED FIXED | ||||||||
| Severity: | Normal | CC: | sergio | ||||||
| Priority: | P2 | ||||||||
| Version: | 528+ (Nightly build) | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Attachments: |
|
||||||||
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> |
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; } }