{"action":"created","comment":{"url":"https://api.github.com/repos/firehol/netdata/pulls/comments/58314375","id":58314375,"diff_hunk":"@@ -44,7 +44,20 @@ void netdata_cleanup_and_exit(int ret)\n \tnetdata_exit = 1;\n \trrdset_save_all();\n \t// kill_childs();\n-\tunlink(RUN_DIR \"/netdata.pid\");\n+\n+\tif(pidfile[0]) {\n+\t\tif(unlink(pidfile) != 0)\n+\t\t\terror(\"Cannot unlink pidfile '%s'.\", pidfile);\n+\t}\n+\n+\tif(pidfd != -1) {","path":"src/main.c","position":11,"original_position":11,"commit_id":"faf66f4f5f39bda8d0b5e947afbdb8cd1ac505be","original_commit_id":"ca808d2231ed175397408ea436a50642e10cd281","user":{"login":"alonbl","id":1263789,"avatar_url":"https://avatars.githubusercontent.com/u/1263789?v=3","gravatar_id":"","url":"https://api.github.com/users/alonbl","html_url":"https://github.com/alonbl","followers_url":"https://api.github.com/users/alonbl/followers","following_url":"https://api.github.com/users/alonbl/following{/other_user}","gists_url":"https://api.github.com/users/alonbl/gists{/gist_id}","starred_url":"https://api.github.com/users/alonbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alonbl/subscriptions","organizations_url":"https://api.github.com/users/alonbl/orgs","repos_url":"https://api.github.com/users/alonbl/repos","events_url":"https://api.github.com/users/alonbl/events{/privacy}","received_events_url":"https://api.github.com/users/alonbl/received_events","type":"User","site_admin":false},"body":"first truncate, close then unlink?\r\n\r\nbut I still do not understand what is the value to keep the pidfile opened all the time?","created_at":"2016-04-03T17:55:55Z","updated_at":"2016-04-03T17:55:55Z","html_url":"https://github.com/firehol/netdata/pull/163#discussion_r58314375","pull_request_url":"https://api.github.com/repos/firehol/netdata/pulls/163","_links":{"self":{"href":"https://api.github.com/repos/firehol/netdata/pulls/comments/58314375"},"html":{"href":"https://github.com/firehol/netdata/pull/163#discussion_r58314375"},"pull_request":{"href":"https://api.github.com/repos/firehol/netdata/pulls/163"}}},"pull_request":{"url":"https://api.github.com/repos/firehol/netdata/pulls/163","id":65072289,"html_url":"https://github.com/firehol/netdata/pull/163","diff_url":"https://github.com/firehol/netdata/pull/163.diff","patch_url":"https://github.com/firehol/netdata/pull/163.patch","issue_url":"https://api.github.com/repos/firehol/netdata/issues/163","number":163,"state":"open","locked":false,"title":"added command line parameter -pidfile; the pidfile is only generated …","user":{"login":"ktsaou","id":2662304,"avatar_url":"https://avatars.githubusercontent.com/u/2662304?v=3","gravatar_id":"","url":"https://api.github.com/users/ktsaou","html_url":"https://github.com/ktsaou","followers_url":"https://api.github.com/users/ktsaou/followers","following_url":"https://api.github.com/users/ktsaou/following{/other_user}","gists_url":"https://api.github.com/users/ktsaou/gists{/gist_id}","starred_url":"https://api.github.com/users/ktsaou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ktsaou/subscriptions","organizations_url":"https://api.github.com/users/ktsaou/orgs","repos_url":"https://api.github.com/users/ktsaou/repos","events_url":"https://api.github.com/users/ktsaou/events{/privacy}","received_events_url":"https://api.github.com/users/ktsaou/received_events","type":"User","site_admin":false},"body":"…if this parameter is passed; #151 #156 \r\n\r\n@alonbl please check.","created_at":"2016-04-03T16:00:10Z","updated_at":"2016-04-03T17:55:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca2aef1f7dde33078f5675104269ee2873975c33","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/firehol/netdata/pulls/163/commits","review_comments_url":"https://api.github.com/repos/firehol/netdata/pulls/163/comments","review_comment_url":"https://api.github.com/repos/firehol/netdata/pulls/comments{/number}","comments_url":"https://api.github.com/repos/firehol/netdata/issues/163/comments","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/faf66f4f5f39bda8d0b5e947afbdb8cd1ac505be","head":{"label":"firehol:pidfile","ref":"pidfile","sha":"faf66f4f5f39bda8d0b5e947afbdb8cd1ac505be","user":{"login":"firehol","id":9442231,"avatar_url":"https://avatars.githubusercontent.com/u/9442231?v=3","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"repo":{"id":10744183,"name":"netdata","full_name":"firehol/netdata","owner":{"login":"firehol","id":9442231,"avatar_url":"https://avatars.githubusercontent.com/u/9442231?v=3","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firehol/netdata","description":"Real-time performance monitoring, done right!","fork":false,"url":"https://api.github.com/repos/firehol/netdata","forks_url":"https://api.github.com/repos/firehol/netdata/forks","keys_url":"https://api.github.com/repos/firehol/netdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firehol/netdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firehol/netdata/teams","hooks_url":"https://api.github.com/repos/firehol/netdata/hooks","issue_events_url":"https://api.github.com/repos/firehol/netdata/issues/events{/number}","events_url":"https://api.github.com/repos/firehol/netdata/events","assignees_url":"https://api.github.com/repos/firehol/netdata/assignees{/user}","branches_url":"https://api.github.com/repos/firehol/netdata/branches{/branch}","tags_url":"https://api.github.com/repos/firehol/netdata/tags","blobs_url":"https://api.github.com/repos/firehol/netdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firehol/netdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firehol/netdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/firehol/netdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/{sha}","languages_url":"https://api.github.com/repos/firehol/netdata/languages","stargazers_url":"https://api.github.com/repos/firehol/netdata/stargazers","contributors_url":"https://api.github.com/repos/firehol/netdata/contributors","subscribers_url":"https://api.github.com/repos/firehol/netdata/subscribers","subscription_url":"https://api.github.com/repos/firehol/netdata/subscription","commits_url":"https://api.github.com/repos/firehol/netdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/firehol/netdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/firehol/netdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/firehol/netdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/firehol/netdata/contents/{+path}","compare_url":"https://api.github.com/repos/firehol/netdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firehol/netdata/merges","archive_url":"https://api.github.com/repos/firehol/netdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firehol/netdata/downloads","issues_url":"https://api.github.com/repos/firehol/netdata/issues{/number}","pulls_url":"https://api.github.com/repos/firehol/netdata/pulls{/number}","milestones_url":"https://api.github.com/repos/firehol/netdata/milestones{/number}","notifications_url":"https://api.github.com/repos/firehol/netdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firehol/netdata/labels{/name}","releases_url":"https://api.github.com/repos/firehol/netdata/releases{/id}","deployments_url":"https://api.github.com/repos/firehol/netdata/deployments","created_at":"2013-06-17T18:39:10Z","updated_at":"2016-04-03T17:52:07Z","pushed_at":"2016-04-03T16:38:55Z","git_url":"git://github.com/firehol/netdata.git","ssh_url":"git@github.com:firehol/netdata.git","clone_url":"https://github.com/firehol/netdata.git","svn_url":"https://github.com/firehol/netdata","homepage":"http://netdata.firehol.org","size":3114,"stargazers_count":6425,"watchers_count":6425,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":329,"mirror_url":null,"open_issues_count":63,"forks":329,"open_issues":63,"watchers":6425,"default_branch":"master"}},"base":{"label":"firehol:master","ref":"master","sha":"20734c375ec88f4155d4747bfca3d78e2891f398","user":{"login":"firehol","id":9442231,"avatar_url":"https://avatars.githubusercontent.com/u/9442231?v=3","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"repo":{"id":10744183,"name":"netdata","full_name":"firehol/netdata","owner":{"login":"firehol","id":9442231,"avatar_url":"https://avatars.githubusercontent.com/u/9442231?v=3","gravatar_id":"","url":"https://api.github.com/users/firehol","html_url":"https://github.com/firehol","followers_url":"https://api.github.com/users/firehol/followers","following_url":"https://api.github.com/users/firehol/following{/other_user}","gists_url":"https://api.github.com/users/firehol/gists{/gist_id}","starred_url":"https://api.github.com/users/firehol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/firehol/subscriptions","organizations_url":"https://api.github.com/users/firehol/orgs","repos_url":"https://api.github.com/users/firehol/repos","events_url":"https://api.github.com/users/firehol/events{/privacy}","received_events_url":"https://api.github.com/users/firehol/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/firehol/netdata","description":"Real-time performance monitoring, done right!","fork":false,"url":"https://api.github.com/repos/firehol/netdata","forks_url":"https://api.github.com/repos/firehol/netdata/forks","keys_url":"https://api.github.com/repos/firehol/netdata/keys{/key_id}","collaborators_url":"https://api.github.com/repos/firehol/netdata/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/firehol/netdata/teams","hooks_url":"https://api.github.com/repos/firehol/netdata/hooks","issue_events_url":"https://api.github.com/repos/firehol/netdata/issues/events{/number}","events_url":"https://api.github.com/repos/firehol/netdata/events","assignees_url":"https://api.github.com/repos/firehol/netdata/assignees{/user}","branches_url":"https://api.github.com/repos/firehol/netdata/branches{/branch}","tags_url":"https://api.github.com/repos/firehol/netdata/tags","blobs_url":"https://api.github.com/repos/firehol/netdata/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/firehol/netdata/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/firehol/netdata/git/refs{/sha}","trees_url":"https://api.github.com/repos/firehol/netdata/git/trees{/sha}","statuses_url":"https://api.github.com/repos/firehol/netdata/statuses/{sha}","languages_url":"https://api.github.com/repos/firehol/netdata/languages","stargazers_url":"https://api.github.com/repos/firehol/netdata/stargazers","contributors_url":"https://api.github.com/repos/firehol/netdata/contributors","subscribers_url":"https://api.github.com/repos/firehol/netdata/subscribers","subscription_url":"https://api.github.com/repos/firehol/netdata/subscription","commits_url":"https://api.github.com/repos/firehol/netdata/commits{/sha}","git_commits_url":"https://api.github.com/repos/firehol/netdata/git/commits{/sha}","comments_url":"https://api.github.com/repos/firehol/netdata/comments{/number}","issue_comment_url":"https://api.github.com/repos/firehol/netdata/issues/comments{/number}","contents_url":"https://api.github.com/repos/firehol/netdata/contents/{+path}","compare_url":"https://api.github.com/repos/firehol/netdata/compare/{base}...{head}","merges_url":"https://api.github.com/repos/firehol/netdata/merges","archive_url":"https://api.github.com/repos/firehol/netdata/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/firehol/netdata/downloads","issues_url":"https://api.github.com/repos/firehol/netdata/issues{/number}","pulls_url":"https://api.github.com/repos/firehol/netdata/pulls{/number}","milestones_url":"https://api.github.com/repos/firehol/netdata/milestones{/number}","notifications_url":"https://api.github.com/repos/firehol/netdata/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/firehol/netdata/labels{/name}","releases_url":"https://api.github.com/repos/firehol/netdata/releases{/id}","deployments_url":"https://api.github.com/repos/firehol/netdata/deployments","created_at":"2013-06-17T18:39:10Z","updated_at":"2016-04-03T17:52:07Z","pushed_at":"2016-04-03T16:38:55Z","git_url":"git://github.com/firehol/netdata.git","ssh_url":"git@github.com:firehol/netdata.git","clone_url":"https://github.com/firehol/netdata.git","svn_url":"https://github.com/firehol/netdata","homepage":"http://netdata.firehol.org","size":3114,"stargazers_count":6425,"watchers_count":6425,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":329,"mirror_url":null,"open_issues_count":63,"forks":329,"open_issues":63,"watchers":6425,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/firehol/netdata/pulls/163"},"html":{"href":"https://github.com/firehol/netdata/pull/163"},"issue":{"href":"https://api.github.com/repos/firehol/netdata/issues/163"},"comments":{"href":"https://api.github.com/repos/firehol/netdata/issues/163/comments"},"review_comments":{"href":"https://api.github.com/repos/firehol/netdata/pulls/163/comments"},"review_comment":{"href":"https://api.github.com/repos/firehol/netdata/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/firehol/netdata/pulls/163/commits"},"statuses":{"href":"https://api.github.com/repos/firehol/netdata/statuses/faf66f4f5f39bda8d0b5e947afbdb8cd1ac505be"}}}}