{"action":"created","comment":{"url":"https://api.github.com/repos/monero-project/monero/pulls/comments/197627749","pull_request_review_id":131411078,"id":197627749,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzYyNzc0OQ==","diff_hunk":"@@ -195,6 +195,57 @@ namespace tools\n     catch (...) {}\n   }\n \n+  file_locker::file_locker(const std::string& filename)\n+  {\n+#ifdef WIN32\n+    m_fd = INVALID_HANDLE_VALUE;\n+    WCHAR wide_path[1000];\n+    if (MultiByteToWideChar(CP_UTF8, 0, filename.c_str(), filename.size() + 1, wide_path, 1000))\n+    {\n+      m_fd = CreateFileW(wide_path, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\n+      if (m_fd != INVALID_HANDLE_VALUE)\n+      {\n+        OVERLAPPED ov;\n+        memset(&ov, 0, sizeof(ov));\n+        if (!LockFileEx(m_fd, LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK, 0, 1, 0, &ov))\n+        {\n+          CloseHandle(m_fd);\n+          m_fd = INVALID_HANDLE_VALUE;\n+        }\n+      }\n+    }\n+#else\n+    m_fd = open(filename.c_str(), O_RDONLY | O_CREAT, 0666);\n+    if (m_fd != -1)\n+    {\n+      if (flock(m_fd, LOCK_EX | LOCK_NB) == -1)\n+      {\n+        close(m_fd);","path":"src/common/util.cpp","position":null,"original_position":29,"commit_id":"5a82dfb628884702f0d820db20e197ede24f6fbb","original_commit_id":"ea388d74dbaf971be120d755aa97971434d7913a","user":{"login":"stoffu","id":26077532,"node_id":"MDQ6VXNlcjI2MDc3NTMy","avatar_url":"https://avatars1.githubusercontent.com/u/26077532?v=4","gravatar_id":"","url":"https://api.github.com/users/stoffu","html_url":"https://github.com/stoffu","followers_url":"https://api.github.com/users/stoffu/followers","following_url":"https://api.github.com/users/stoffu/following{/other_user}","gists_url":"https://api.github.com/users/stoffu/gists{/gist_id}","starred_url":"https://api.github.com/users/stoffu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stoffu/subscriptions","organizations_url":"https://api.github.com/users/stoffu/orgs","repos_url":"https://api.github.com/users/stoffu/repos","events_url":"https://api.github.com/users/stoffu/events{/privacy}","received_events_url":"https://api.github.com/users/stoffu/received_events","type":"User","site_admin":false},"body":"ok","created_at":"2018-06-24T04:02:02Z","updated_at":"2018-06-24T04:02:02Z","html_url":"https://github.com/monero-project/monero/pull/3994#discussion_r197627749","pull_request_url":"https://api.github.com/repos/monero-project/monero/pulls/3994","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/monero-project/monero/pulls/comments/197627749"},"html":{"href":"https://github.com/monero-project/monero/pull/3994#discussion_r197627749"},"pull_request":{"href":"https://api.github.com/repos/monero-project/monero/pulls/3994"}},"in_reply_to_id":197611237},"pull_request":{"url":"https://api.github.com/repos/monero-project/monero/pulls/3994","id":194178661,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0MTc4NjYx","html_url":"https://github.com/monero-project/monero/pull/3994","diff_url":"https://github.com/monero-project/monero/pull/3994.diff","patch_url":"https://github.com/monero-project/monero/pull/3994.patch","issue_url":"https://api.github.com/repos/monero-project/monero/issues/3994","number":3994,"state":"open","locked":false,"title":"wallet: prevent the same wallet file from being opened by multiple processes","user":{"login":"stoffu","id":26077532,"node_id":"MDQ6VXNlcjI2MDc3NTMy","avatar_url":"https://avatars1.githubusercontent.com/u/26077532?v=4","gravatar_id":"","url":"https://api.github.com/users/stoffu","html_url":"https://github.com/stoffu","followers_url":"https://api.github.com/users/stoffu/followers","following_url":"https://api.github.com/users/stoffu/following{/other_user}","gists_url":"https://api.github.com/users/stoffu/gists{/gist_id}","starred_url":"https://api.github.com/users/stoffu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stoffu/subscriptions","organizations_url":"https://api.github.com/users/stoffu/orgs","repos_url":"https://api.github.com/users/stoffu/repos","events_url":"https://api.github.com/users/stoffu/events{/privacy}","received_events_url":"https://api.github.com/users/stoffu/received_events","type":"User","site_admin":false},"body":"Maybe this way of trying to lock a file is stupid, but perhaps better than nothing...","created_at":"2018-06-12T06:33:26Z","updated_at":"2018-06-24T04:02:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb73c9bcad12fad6e7954231f243731ed8be0696","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/monero-project/monero/pulls/3994/commits","review_comments_url":"https://api.github.com/repos/monero-project/monero/pulls/3994/comments","review_comment_url":"https://api.github.com/repos/monero-project/monero/pulls/comments{/number}","comments_url":"https://api.github.com/repos/monero-project/monero/issues/3994/comments","statuses_url":"https://api.github.com/repos/monero-project/monero/statuses/5a82dfb628884702f0d820db20e197ede24f6fbb","head":{"label":"stoffu:lock-keys-file","ref":"lock-keys-file","sha":"5a82dfb628884702f0d820db20e197ede24f6fbb","user":{"login":"stoffu","id":26077532,"node_id":"MDQ6VXNlcjI2MDc3NTMy","avatar_url":"https://avatars1.githubusercontent.com/u/26077532?v=4","gravatar_id":"","url":"https://api.github.com/users/stoffu","html_url":"https://github.com/stoffu","followers_url":"https://api.github.com/users/stoffu/followers","following_url":"https://api.github.com/users/stoffu/following{/other_user}","gists_url":"https://api.github.com/users/stoffu/gists{/gist_id}","starred_url":"https://api.github.com/users/stoffu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stoffu/subscriptions","organizations_url":"https://api.github.com/users/stoffu/orgs","repos_url":"https://api.github.com/users/stoffu/repos","events_url":"https://api.github.com/users/stoffu/events{/privacy}","received_events_url":"https://api.github.com/users/stoffu/received_events","type":"User","site_admin":false},"repo":{"id":83384496,"node_id":"MDEwOlJlcG9zaXRvcnk4MzM4NDQ5Ng==","name":"monero","full_name":"stoffu/monero","owner":{"login":"stoffu","id":26077532,"node_id":"MDQ6VXNlcjI2MDc3NTMy","avatar_url":"https://avatars1.githubusercontent.com/u/26077532?v=4","gravatar_id":"","url":"https://api.github.com/users/stoffu","html_url":"https://github.com/stoffu","followers_url":"https://api.github.com/users/stoffu/followers","following_url":"https://api.github.com/users/stoffu/following{/other_user}","gists_url":"https://api.github.com/users/stoffu/gists{/gist_id}","starred_url":"https://api.github.com/users/stoffu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stoffu/subscriptions","organizations_url":"https://api.github.com/users/stoffu/orgs","repos_url":"https://api.github.com/users/stoffu/repos","events_url":"https://api.github.com/users/stoffu/events{/privacy}","received_events_url":"https://api.github.com/users/stoffu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stoffu/monero","description":"Monero: the secure, private, untraceable cryptocurrency","fork":true,"url":"https://api.github.com/repos/stoffu/monero","forks_url":"https://api.github.com/repos/stoffu/monero/forks","keys_url":"https://api.github.com/repos/stoffu/monero/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stoffu/monero/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stoffu/monero/teams","hooks_url":"https://api.github.com/repos/stoffu/monero/hooks","issue_events_url":"https://api.github.com/repos/stoffu/monero/issues/events{/number}","events_url":"https://api.github.com/repos/stoffu/monero/events","assignees_url":"https://api.github.com/repos/stoffu/monero/assignees{/user}","branches_url":"https://api.github.com/repos/stoffu/monero/branches{/branch}","tags_url":"https://api.github.com/repos/stoffu/monero/tags","blobs_url":"https://api.github.com/repos/stoffu/monero/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stoffu/monero/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stoffu/monero/git/refs{/sha}","trees_url":"https://api.github.com/repos/stoffu/monero/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stoffu/monero/statuses/{sha}","languages_url":"https://api.github.com/repos/stoffu/monero/languages","stargazers_url":"https://api.github.com/repos/stoffu/monero/stargazers","contributors_url":"https://api.github.com/repos/stoffu/monero/contributors","subscribers_url":"https://api.github.com/repos/stoffu/monero/subscribers","subscription_url":"https://api.github.com/repos/stoffu/monero/subscription","commits_url":"https://api.github.com/repos/stoffu/monero/commits{/sha}","git_commits_url":"https://api.github.com/repos/stoffu/monero/git/commits{/sha}","comments_url":"https://api.github.com/repos/stoffu/monero/comments{/number}","issue_comment_url":"https://api.github.com/repos/stoffu/monero/issues/comments{/number}","contents_url":"https://api.github.com/repos/stoffu/monero/contents/{+path}","compare_url":"https://api.github.com/repos/stoffu/monero/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stoffu/monero/merges","archive_url":"https://api.github.com/repos/stoffu/monero/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stoffu/monero/downloads","issues_url":"https://api.github.com/repos/stoffu/monero/issues{/number}","pulls_url":"https://api.github.com/repos/stoffu/monero/pulls{/number}","milestones_url":"https://api.github.com/repos/stoffu/monero/milestones{/number}","notifications_url":"https://api.github.com/repos/stoffu/monero/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stoffu/monero/labels{/name}","releases_url":"https://api.github.com/repos/stoffu/monero/releases{/id}","deployments_url":"https://api.github.com/repos/stoffu/monero/deployments","created_at":"2017-02-28T03:21:08Z","updated_at":"2018-06-21T02:09:06Z","pushed_at":"2018-06-24T04:01:25Z","git_url":"git://github.com/stoffu/monero.git","ssh_url":"git@github.com:stoffu/monero.git","clone_url":"https://github.com/stoffu/monero.git","svn_url":"https://github.com/stoffu/monero","homepage":"https://getmonero.org","size":142385,"stargazers_count":4,"watchers_count":4,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":4,"default_branch":"master"}},"base":{"label":"monero-project:master","ref":"master","sha":"ffab67004ca9a846d6f6d39de552e7ce79febf88","user":{"login":"monero-project","id":7450663,"node_id":"MDQ6VXNlcjc0NTA2NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/7450663?v=4","gravatar_id":"","url":"https://api.github.com/users/monero-project","html_url":"https://github.com/monero-project","followers_url":"https://api.github.com/users/monero-project/followers","following_url":"https://api.github.com/users/monero-project/following{/other_user}","gists_url":"https://api.github.com/users/monero-project/gists{/gist_id}","starred_url":"https://api.github.com/users/monero-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monero-project/subscriptions","organizations_url":"https://api.github.com/users/monero-project/orgs","repos_url":"https://api.github.com/users/monero-project/repos","events_url":"https://api.github.com/users/monero-project/events{/privacy}","received_events_url":"https://api.github.com/users/monero-project/received_events","type":"User","site_admin":false},"repo":{"id":19316619,"node_id":"MDEwOlJlcG9zaXRvcnkxOTMxNjYxOQ==","name":"monero","full_name":"monero-project/monero","owner":{"login":"monero-project","id":7450663,"node_id":"MDQ6VXNlcjc0NTA2NjM=","avatar_url":"https://avatars2.githubusercontent.com/u/7450663?v=4","gravatar_id":"","url":"https://api.github.com/users/monero-project","html_url":"https://github.com/monero-project","followers_url":"https://api.github.com/users/monero-project/followers","following_url":"https://api.github.com/users/monero-project/following{/other_user}","gists_url":"https://api.github.com/users/monero-project/gists{/gist_id}","starred_url":"https://api.github.com/users/monero-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monero-project/subscriptions","organizations_url":"https://api.github.com/users/monero-project/orgs","repos_url":"https://api.github.com/users/monero-project/repos","events_url":"https://api.github.com/users/monero-project/events{/privacy}","received_events_url":"https://api.github.com/users/monero-project/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/monero-project/monero","description":"Monero: the secure, private, untraceable cryptocurrency","fork":false,"url":"https://api.github.com/repos/monero-project/monero","forks_url":"https://api.github.com/repos/monero-project/monero/forks","keys_url":"https://api.github.com/repos/monero-project/monero/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monero-project/monero/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monero-project/monero/teams","hooks_url":"https://api.github.com/repos/monero-project/monero/hooks","issue_events_url":"https://api.github.com/repos/monero-project/monero/issues/events{/number}","events_url":"https://api.github.com/repos/monero-project/monero/events","assignees_url":"https://api.github.com/repos/monero-project/monero/assignees{/user}","branches_url":"https://api.github.com/repos/monero-project/monero/branches{/branch}","tags_url":"https://api.github.com/repos/monero-project/monero/tags","blobs_url":"https://api.github.com/repos/monero-project/monero/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monero-project/monero/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monero-project/monero/git/refs{/sha}","trees_url":"https://api.github.com/repos/monero-project/monero/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monero-project/monero/statuses/{sha}","languages_url":"https://api.github.com/repos/monero-project/monero/languages","stargazers_url":"https://api.github.com/repos/monero-project/monero/stargazers","contributors_url":"https://api.github.com/repos/monero-project/monero/contributors","subscribers_url":"https://api.github.com/repos/monero-project/monero/subscribers","subscription_url":"https://api.github.com/repos/monero-project/monero/subscription","commits_url":"https://api.github.com/repos/monero-project/monero/commits{/sha}","git_commits_url":"https://api.github.com/repos/monero-project/monero/git/commits{/sha}","comments_url":"https://api.github.com/repos/monero-project/monero/comments{/number}","issue_comment_url":"https://api.github.com/repos/monero-project/monero/issues/comments{/number}","contents_url":"https://api.github.com/repos/monero-project/monero/contents/{+path}","compare_url":"https://api.github.com/repos/monero-project/monero/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monero-project/monero/merges","archive_url":"https://api.github.com/repos/monero-project/monero/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monero-project/monero/downloads","issues_url":"https://api.github.com/repos/monero-project/monero/issues{/number}","pulls_url":"https://api.github.com/repos/monero-project/monero/pulls{/number}","milestones_url":"https://api.github.com/repos/monero-project/monero/milestones{/number}","notifications_url":"https://api.github.com/repos/monero-project/monero/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monero-project/monero/labels{/name}","releases_url":"https://api.github.com/repos/monero-project/monero/releases{/id}","deployments_url":"https://api.github.com/repos/monero-project/monero/deployments","created_at":"2014-04-30T14:38:28Z","updated_at":"2018-06-23T22:42:09Z","pushed_at":"2018-06-24T04:01:28Z","git_url":"git://github.com/monero-project/monero.git","ssh_url":"git@github.com:monero-project/monero.git","clone_url":"https://github.com/monero-project/monero.git","svn_url":"https://github.com/monero-project/monero","homepage":"https://getmonero.org","size":140348,"stargazers_count":3073,"watchers_count":3073,"language":"C++","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1540,"mirror_url":null,"archived":false,"open_issues_count":329,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1540,"open_issues":329,"watchers":3073,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/monero-project/monero/pulls/3994"},"html":{"href":"https://github.com/monero-project/monero/pull/3994"},"issue":{"href":"https://api.github.com/repos/monero-project/monero/issues/3994"},"comments":{"href":"https://api.github.com/repos/monero-project/monero/issues/3994/comments"},"review_comments":{"href":"https://api.github.com/repos/monero-project/monero/pulls/3994/comments"},"review_comment":{"href":"https://api.github.com/repos/monero-project/monero/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/monero-project/monero/pulls/3994/commits"},"statuses":{"href":"https://api.github.com/repos/monero-project/monero/statuses/5a82dfb628884702f0d820db20e197ede24f6fbb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"stoffu"}}