...rather than calling fcntl on them directly after creation.
Bug: https://code.google.com/p/android/issues/detail?id=201440
Change-Id: Ia3941b7645455d69620b1a361902df009b5da2c5
// found that all logd crashes thus far have had no problem stuffing
// the UNIX domain socket and moving on so not critical *today*.
- int log_fd = TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0));
- if (log_fd < 0) {
- return -1;
- }
-
- if (fcntl(log_fd, F_SETFL, O_NONBLOCK) == -1) {
- close(log_fd);
+ int log_fd = TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0));
+ if (log_fd == -1) {
return -1;
}