Create logging sockets with SOCK_NONBLOCK...

...rather than calling fcntl on them directly after creation.

Bug: https://code.google.com/p/android/issues/detail?id=201440
Change-Id: Ia3941b7645455d69620b1a361902df009b5da2c5
This commit is contained in:
Elliott Hughes 2016-02-27 19:18:41 -08:00
parent 31adf6cd38
commit 0f67d5ffa4
1 changed files with 2 additions and 7 deletions

View File

@ -459,13 +459,8 @@ static int __libc_open_log_socket() {
// 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;
}