{"action":"created","comment":{"url":"https://api.github.com/repos/neovim/neovim/pulls/comments/37024695","id":37024695,"diff_hunk":"@@ -279,13 +279,24 @@ bool os_file_is_readonly(const char *name)\n   return access(name, W_OK) != 0;\n }\n \n+/// Check if a file is readable.\n+///\n+/// @return 0 if `name` is not writable,\n+/// @return 1 if `name` is writable,\n+/// @return 2 for a directory which we have rights to write into.\n+bool os_file_is_readable(const char *name)\n+  FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT\n+{\n+  return (access(name, R_OK) == 0);","path":"src/nvim/os/fs.c","position":12,"original_position":12,"commit_id":"44e3e92df797649116ff8397987560ae1f806c42","original_commit_id":"44e3e92df797649116ff8397987560ae1f806c42","user":{"login":"equalsraf","id":715238,"avatar_url":"https://avatars.githubusercontent.com/u/715238?v=3","gravatar_id":"","url":"https://api.github.com/users/equalsraf","html_url":"https://github.com/equalsraf","followers_url":"https://api.github.com/users/equalsraf/followers","following_url":"https://api.github.com/users/equalsraf/following{/other_user}","gists_url":"https://api.github.com/users/equalsraf/gists{/gist_id}","starred_url":"https://api.github.com/users/equalsraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/equalsraf/subscriptions","organizations_url":"https://api.github.com/users/equalsraf/orgs","repos_url":"https://api.github.com/users/equalsraf/repos","events_url":"https://api.github.com/users/equalsraf/events{/privacy}","received_events_url":"https://api.github.com/users/equalsraf/received_events","type":"User","site_admin":false},"body":"Should be ok, just need to add a define for R_OK to 04 ([docs](https://msdn.microsoft.com/en-us/library/1w06ktdy.aspx))","created_at":"2015-08-13T20:59:57Z","updated_at":"2015-08-13T20:59:57Z","html_url":"https://github.com/neovim/neovim/pull/3166#discussion_r37024695","pull_request_url":"https://api.github.com/repos/neovim/neovim/pulls/3166","_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments/37024695"},"html":{"href":"https://github.com/neovim/neovim/pull/3166#discussion_r37024695"},"pull_request":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3166"}}},"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/3166","id":42308044,"html_url":"https://github.com/neovim/neovim/pull/3166","diff_url":"https://github.com/neovim/neovim/pull/3166.diff","patch_url":"https://github.com/neovim/neovim/pull/3166.patch","issue_url":"https://api.github.com/repos/neovim/neovim/issues/3166","number":3166,"state":"open","locked":false,"title":"os_file_is_readable()","user":{"login":"justinmk","id":1359421,"avatar_url":"https://avatars.githubusercontent.com/u/1359421?v=3","gravatar_id":"","url":"https://api.github.com/users/justinmk","html_url":"https://github.com/justinmk","followers_url":"https://api.github.com/users/justinmk/followers","following_url":"https://api.github.com/users/justinmk/following{/other_user}","gists_url":"https://api.github.com/users/justinmk/gists{/gist_id}","starred_url":"https://api.github.com/users/justinmk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinmk/subscriptions","organizations_url":"https://api.github.com/users/justinmk/orgs","repos_url":"https://api.github.com/users/justinmk/repos","events_url":"https://api.github.com/users/justinmk/events{/privacy}","received_events_url":"https://api.github.com/users/justinmk/received_events","type":"User","site_admin":false},"body":"Use access() instead of the traditional Vim open() approach, because:\r\n\r\n- We already use it for os_file_is_writable()\r\n- This passage in open(3) mentions a benefit:\r\n  \"[...] using the calling process's real UID and GID, rather than the\r\n  effective IDs as is done when actually attempting an operation (e.g.,\r\n  open(2)) on the file [...] allows set-user-ID programs to easily\r\n  determine the invoking user's authority.\"","created_at":"2015-08-13T01:45:08Z","updated_at":"2015-08-13T20:59:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d39120ee34e70e9b230687cf8ea5e47f522354f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neovim/neovim/pulls/3166/commits","review_comments_url":"https://api.github.com/repos/neovim/neovim/pulls/3166/comments","review_comment_url":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/3166/comments","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/44e3e92df797649116ff8397987560ae1f806c42","head":{"label":"justinmk:file_is_readable","ref":"file_is_readable","sha":"44e3e92df797649116ff8397987560ae1f806c42","user":{"login":"justinmk","id":1359421,"avatar_url":"https://avatars.githubusercontent.com/u/1359421?v=3","gravatar_id":"","url":"https://api.github.com/users/justinmk","html_url":"https://github.com/justinmk","followers_url":"https://api.github.com/users/justinmk/followers","following_url":"https://api.github.com/users/justinmk/following{/other_user}","gists_url":"https://api.github.com/users/justinmk/gists{/gist_id}","starred_url":"https://api.github.com/users/justinmk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinmk/subscriptions","organizations_url":"https://api.github.com/users/justinmk/orgs","repos_url":"https://api.github.com/users/justinmk/repos","events_url":"https://api.github.com/users/justinmk/events{/privacy}","received_events_url":"https://api.github.com/users/justinmk/received_events","type":"User","site_admin":false},"repo":{"id":17302877,"name":"neovim","full_name":"justinmk/neovim","owner":{"login":"justinmk","id":1359421,"avatar_url":"https://avatars.githubusercontent.com/u/1359421?v=3","gravatar_id":"","url":"https://api.github.com/users/justinmk","html_url":"https://github.com/justinmk","followers_url":"https://api.github.com/users/justinmk/followers","following_url":"https://api.github.com/users/justinmk/following{/other_user}","gists_url":"https://api.github.com/users/justinmk/gists{/gist_id}","starred_url":"https://api.github.com/users/justinmk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinmk/subscriptions","organizations_url":"https://api.github.com/users/justinmk/orgs","repos_url":"https://api.github.com/users/justinmk/repos","events_url":"https://api.github.com/users/justinmk/events{/privacy}","received_events_url":"https://api.github.com/users/justinmk/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/justinmk/neovim","description":"vim's rebirth for the 21st century","fork":true,"url":"https://api.github.com/repos/justinmk/neovim","forks_url":"https://api.github.com/repos/justinmk/neovim/forks","keys_url":"https://api.github.com/repos/justinmk/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/justinmk/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/justinmk/neovim/teams","hooks_url":"https://api.github.com/repos/justinmk/neovim/hooks","issue_events_url":"https://api.github.com/repos/justinmk/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/justinmk/neovim/events","assignees_url":"https://api.github.com/repos/justinmk/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/justinmk/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/justinmk/neovim/tags","blobs_url":"https://api.github.com/repos/justinmk/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/justinmk/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/justinmk/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/justinmk/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/justinmk/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/justinmk/neovim/languages","stargazers_url":"https://api.github.com/repos/justinmk/neovim/stargazers","contributors_url":"https://api.github.com/repos/justinmk/neovim/contributors","subscribers_url":"https://api.github.com/repos/justinmk/neovim/subscribers","subscription_url":"https://api.github.com/repos/justinmk/neovim/subscription","commits_url":"https://api.github.com/repos/justinmk/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/justinmk/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/justinmk/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/justinmk/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/justinmk/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/justinmk/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/justinmk/neovim/merges","archive_url":"https://api.github.com/repos/justinmk/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/justinmk/neovim/downloads","issues_url":"https://api.github.com/repos/justinmk/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/justinmk/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/justinmk/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/justinmk/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/justinmk/neovim/labels{/name}","releases_url":"https://api.github.com/repos/justinmk/neovim/releases{/id}","created_at":"2014-02-28T23:17:54Z","updated_at":"2014-12-29T18:58:05Z","pushed_at":"2015-08-13T02:02:21Z","git_url":"git://github.com/justinmk/neovim.git","ssh_url":"git@github.com:justinmk/neovim.git","clone_url":"https://github.com/justinmk/neovim.git","svn_url":"https://github.com/justinmk/neovim","homepage":"http://neovim.org/","size":32859,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neovim:master","ref":"master","sha":"a6c612868186278ca8428a8dfaa4064954a920c1","user":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"repo":{"id":16408992,"name":"neovim","full_name":"neovim/neovim","owner":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neovim/neovim","description":"Vim-fork focused on extensibility and agility. Consider helping sustain Neovim development! ","fork":false,"url":"https://api.github.com/repos/neovim/neovim","forks_url":"https://api.github.com/repos/neovim/neovim/forks","keys_url":"https://api.github.com/repos/neovim/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neovim/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neovim/neovim/teams","hooks_url":"https://api.github.com/repos/neovim/neovim/hooks","issue_events_url":"https://api.github.com/repos/neovim/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/neovim/neovim/events","assignees_url":"https://api.github.com/repos/neovim/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/neovim/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/neovim/neovim/tags","blobs_url":"https://api.github.com/repos/neovim/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neovim/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neovim/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/neovim/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/neovim/neovim/languages","stargazers_url":"https://api.github.com/repos/neovim/neovim/stargazers","contributors_url":"https://api.github.com/repos/neovim/neovim/contributors","subscribers_url":"https://api.github.com/repos/neovim/neovim/subscribers","subscription_url":"https://api.github.com/repos/neovim/neovim/subscription","commits_url":"https://api.github.com/repos/neovim/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/neovim/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/neovim/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/neovim/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/neovim/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/neovim/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neovim/neovim/merges","archive_url":"https://api.github.com/repos/neovim/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neovim/neovim/downloads","issues_url":"https://api.github.com/repos/neovim/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/neovim/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/neovim/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/neovim/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neovim/neovim/labels{/name}","releases_url":"https://api.github.com/repos/neovim/neovim/releases{/id}","created_at":"2014-01-31T13:39:22Z","updated_at":"2015-08-13T17:52:22Z","pushed_at":"2015-08-13T20:54:57Z","git_url":"git://github.com/neovim/neovim.git","ssh_url":"git@github.com:neovim/neovim.git","clone_url":"https://github.com/neovim/neovim.git","svn_url":"https://github.com/neovim/neovim","homepage":"https://salt.bountysource.com/teams/neovim","size":82672,"stargazers_count":14528,"watchers_count":14528,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1001,"mirror_url":null,"open_issues_count":566,"forks":1001,"open_issues":566,"watchers":14528,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3166"},"html":{"href":"https://github.com/neovim/neovim/pull/3166"},"issue":{"href":"https://api.github.com/repos/neovim/neovim/issues/3166"},"comments":{"href":"https://api.github.com/repos/neovim/neovim/issues/3166/comments"},"review_comments":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3166/comments"},"review_comment":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neovim/neovim/pulls/3166/commits"},"statuses":{"href":"https://api.github.com/repos/neovim/neovim/statuses/44e3e92df797649116ff8397987560ae1f806c42"}}}}