summaryrefslogtreecommitdiffstats
path: root/src/claim/claim.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/claim/claim.c (renamed from claim/claim.c)12
1 files changed, 3 insertions, 9 deletions
diff --git a/claim/claim.c b/src/claim/claim.c
index 774b65ebb..9b67a6a12 100644
--- a/claim/claim.c
+++ b/src/claim/claim.c
@@ -44,8 +44,6 @@ char *get_agent_claimid()
#define CLAIMING_COMMAND_LENGTH 16384
#define CLAIMING_PROXY_LENGTH (CLAIMING_COMMAND_LENGTH/4)
-extern struct registry registry;
-
/* rrd_init() and post_conf_load() must have been called before this function */
CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, const char **msg __maybe_unused)
{
@@ -102,7 +100,7 @@ CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, con
netdata_log_info("Waiting for claiming command '%s' to finish.", command_exec_buffer);
char read_buffer[100 + 1];
- while (fgets(read_buffer, 100, fp_child_output) != NULL) {;}
+ while (fgets(read_buffer, 100, fp_child_output) != NULL) ;
exit_code = netdata_pclose(fp_child_input, fp_child_output, command_pid);
@@ -138,10 +136,6 @@ CLAIM_AGENT_RESPONSE claim_agent(const char *claiming_arguments, bool force, con
return CLAIM_AGENT_FAILED_WITH_MESSAGE;
}
-#ifdef ENABLE_ACLK
-extern int aclk_connected, aclk_kill_link, aclk_disable_runtime;
-#endif
-
/* Change the claimed state of the agent.
*
* This only happens when the user has explicitly requested it:
@@ -191,9 +185,9 @@ void load_claiming_state(void)
uuid_unparse_lower(uuid, localhost->aclk_state.claimed_id);
}
+ rrdhost_aclk_state_unlock(localhost);
invalidate_node_instances(&localhost->host_uuid, claimed_id ? &uuid : NULL);
metaqueue_store_claim_id(&localhost->host_uuid, claimed_id ? &uuid : NULL);
- rrdhost_aclk_state_unlock(localhost);
if (!claimed_id) {
netdata_log_info("Unable to load '%s', setting state to AGENT_UNCLAIMED", filename);
@@ -262,7 +256,7 @@ bool netdata_random_session_id_generate(void) {
(void)unlink(filename);
// save it
- int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 640);
+ int fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 640);
if(fd == -1) {
netdata_log_error("Cannot create random session id file '%s'.", filename);
ret = false;