RESOLVED FIXED 127842
Fix wrong mix of fcntl commands and flags
https://bugs.webkit.org/show_bug.cgi?id=127842
Summary Fix wrong mix of fcntl commands and flags
Alberto Garcia
Reported 2014-01-29 10:10:32 PST
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; } }
Attachments
Patch (1.51 KB, patch)
2014-01-29 10:14 PST, Alberto Garcia
no flags
Patch (2.49 KB, patch)
2014-01-31 00:35 PST, Alberto Garcia
darin: review+
Alberto Garcia
Comment 1 2014-01-29 10:14:13 PST
Sergio Correia (qrwteyrutiyoup)
Comment 2 2014-01-30 16:17:24 PST
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?
Alberto Garcia
Comment 3 2014-01-31 00:29:55 PST
I think you're right, I'll update the patch.
Alberto Garcia
Comment 4 2014-01-31 00:35:33 PST
Darin Adler
Comment 5 2014-01-31 12:19:05 PST
Comment on attachment 222804 [details] Patch Would be much better if these had test coverage.
Alberto Garcia
Comment 6 2014-02-03 00:14:39 PST
Note You need to log in before you can comment on or make changes to this bug.