{"action":"created","issue":{"url":"https://api.github.com/repos/libuv/libuv/issues/879","repository_url":"https://api.github.com/repos/libuv/libuv","labels_url":"https://api.github.com/repos/libuv/libuv/issues/879/labels{/name}","comments_url":"https://api.github.com/repos/libuv/libuv/issues/879/comments","events_url":"https://api.github.com/repos/libuv/libuv/issues/879/events","html_url":"https://github.com/libuv/libuv/pull/879","id":155498347,"number":879,"title":"darwin: fix setting fd to non-blocking in select(() trick","user":{"login":"saghul","id":317464,"avatar_url":"https://avatars.githubusercontent.com/u/317464?v=3","gravatar_id":"","url":"https://api.github.com/users/saghul","html_url":"https://github.com/saghul","followers_url":"https://api.github.com/users/saghul/followers","following_url":"https://api.github.com/users/saghul/following{/other_user}","gists_url":"https://api.github.com/users/saghul/gists{/gist_id}","starred_url":"https://api.github.com/users/saghul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saghul/subscriptions","organizations_url":"https://api.github.com/users/saghul/orgs","repos_url":"https://api.github.com/users/saghul/repos","events_url":"https://api.github.com/users/saghul/events{/privacy}","received_events_url":"https://api.github.com/users/saghul/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2016-05-18T13:15:01Z","updated_at":"2016-05-23T09:45:24Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/libuv/libuv/pulls/879","html_url":"https://github.com/libuv/libuv/pull/879","diff_url":"https://github.com/libuv/libuv/pull/879.diff","patch_url":"https://github.com/libuv/libuv/pull/879.patch"},"body":"When the select trick is used fd is replaced with the fake fd (one end\r\nof the socketpair) so we're not setting the original fd in non-blocking\r\nmode.\r\n\r\nRefs: https://github.com/nodejs/node/issues/6456#issuecomment-220018822\r\n\r\nR=@indutny\r\n/cc @libuv/collaborators "},"comment":{"url":"https://api.github.com/repos/libuv/libuv/issues/comments/220934928","html_url":"https://github.com/libuv/libuv/pull/879#issuecomment-220934928","issue_url":"https://api.github.com/repos/libuv/libuv/issues/879","id":220934928,"user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2016-05-23T09:45:24Z","updated_at":"2016-05-23T09:45:24Z","body":"You could change the logic to something like this:\r\n```c\r\nint nonblocking;\r\n\r\n// ...\r\nnonblocking = 0;\r\nif (!(flags & UV_STREAM_BLOCKING))\r\n  nonblocking = fcntl(fd, F_GETFL);\r\nif (nonblocking == -1)\r\n  return -errno;\r\nnonblocking &= O_NONBLOCK;\r\n\r\nif (nonblocking)\r\n  uv__nonblock(fd, 1);\r\n\r\n// Then, on error:\r\nif (nonblocking)\r\n  uv__nonblock(fd, 0);\r\n```"}}
{"actor":{"display_login":"bnoordhuis"}}