diff options
Diffstat (limited to 'other/bootstrap_daemon/tox-bootstrapd.c')
-rw-r--r-- | other/bootstrap_daemon/tox-bootstrapd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c index 40fbf62a..8fc5c1e9 100644 --- a/other/bootstrap_daemon/tox-bootstrapd.c +++ b/other/bootstrap_daemon/tox-bootstrapd.c | |||
@@ -89,7 +89,7 @@ int manage_keys(DHT *dht, char *keys_file_path) | |||
89 | keys_file = fopen(keys_file_path, "r"); | 89 | keys_file = fopen(keys_file_path, "r"); |
90 | 90 | ||
91 | if (keys_file != NULL) { | 91 | if (keys_file != NULL) { |
92 | size_t read_size = fread(keys, sizeof(uint8_t), KEYS_SIZE, keys_file); | 92 | const size_t read_size = fread(keys, sizeof(uint8_t), KEYS_SIZE, keys_file); |
93 | 93 | ||
94 | if (read_size != KEYS_SIZE) { | 94 | if (read_size != KEYS_SIZE) { |
95 | fclose(keys_file); | 95 | fclose(keys_file); |
@@ -105,7 +105,7 @@ int manage_keys(DHT *dht, char *keys_file_path) | |||
105 | 105 | ||
106 | keys_file = fopen(keys_file_path, "w"); | 106 | keys_file = fopen(keys_file_path, "w"); |
107 | 107 | ||
108 | size_t write_size = fwrite(keys, sizeof(uint8_t), KEYS_SIZE, keys_file); | 108 | const size_t write_size = fwrite(keys, sizeof(uint8_t), KEYS_SIZE, keys_file); |
109 | 109 | ||
110 | if (write_size != KEYS_SIZE) { | 110 | if (write_size != KEYS_SIZE) { |
111 | fclose(keys_file); | 111 | fclose(keys_file); |
@@ -233,7 +233,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int | |||
233 | // returns 1 on success | 233 | // returns 1 on success |
234 | // 0 on failure, doesn't modify any data pointed by arguments | 234 | // 0 on failure, doesn't modify any data pointed by arguments |
235 | 235 | ||
236 | int get_general_config(char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6, | 236 | int get_general_config(const char *cfg_file_path, char **pid_file_path, char **keys_file_path, int *port, int *enable_ipv6, |
237 | int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports, | 237 | int *enable_ipv4_fallback, int *enable_lan_discovery, int *enable_tcp_relay, uint16_t **tcp_relay_ports, |
238 | int *tcp_relay_port_count, int *enable_motd, char **motd) | 238 | int *tcp_relay_port_count, int *enable_motd, char **motd) |
239 | { | 239 | { |
@@ -390,7 +390,7 @@ int get_general_config(char *cfg_file_path, char **pid_file_path, char **keys_fi | |||
390 | // returns 1 on success, some or no bootstrap nodes were added | 390 | // returns 1 on success, some or no bootstrap nodes were added |
391 | // 0 on failure, a error accured while parsing config file | 391 | // 0 on failure, a error accured while parsing config file |
392 | 392 | ||
393 | int bootstrap_from_config(char *cfg_file_path, DHT *dht, int enable_ipv6) | 393 | int bootstrap_from_config(const char *cfg_file_path, DHT *dht, int enable_ipv6) |
394 | { | 394 | { |
395 | const char *NAME_BOOTSTRAP_NODES = "bootstrap_nodes"; | 395 | const char *NAME_BOOTSTRAP_NODES = "bootstrap_nodes"; |
396 | 396 | ||
@@ -495,7 +495,7 @@ next: | |||
495 | 495 | ||
496 | // Prints public key | 496 | // Prints public key |
497 | 497 | ||
498 | void print_public_key(uint8_t *public_key) | 498 | void print_public_key(const uint8_t *public_key) |
499 | { | 499 | { |
500 | char buffer[2 * crypto_box_PUBLICKEYBYTES + 1]; | 500 | char buffer[2 * crypto_box_PUBLICKEYBYTES + 1]; |
501 | int index = 0; | 501 | int index = 0; |
@@ -522,7 +522,7 @@ int main(int argc, char *argv[]) | |||
522 | return 1; | 522 | return 1; |
523 | } | 523 | } |
524 | 524 | ||
525 | char *cfg_file_path = argv[1]; | 525 | const char *cfg_file_path = argv[1]; |
526 | char *pid_file_path, *keys_file_path; | 526 | char *pid_file_path, *keys_file_path; |
527 | int port; | 527 | int port; |
528 | int enable_ipv6; | 528 | int enable_ipv6; |
@@ -653,7 +653,7 @@ int main(int argc, char *argv[]) | |||
653 | free(keys_file_path); | 653 | free(keys_file_path); |
654 | 654 | ||
655 | // Fork off from the parent process | 655 | // Fork off from the parent process |
656 | pid_t pid = fork(); | 656 | const pid_t pid = fork(); |
657 | 657 | ||
658 | if (pid > 0) { | 658 | if (pid > 0) { |
659 | fprintf(pidf, "%d", pid); | 659 | fprintf(pidf, "%d", pid); |
@@ -690,7 +690,7 @@ int main(int argc, char *argv[]) | |||
690 | close(STDERR_FILENO); | 690 | close(STDERR_FILENO); |
691 | 691 | ||
692 | uint64_t last_LANdiscovery = 0; | 692 | uint64_t last_LANdiscovery = 0; |
693 | uint16_t htons_port = htons(port); | 693 | const uint16_t htons_port = htons(port); |
694 | 694 | ||
695 | int waiting_for_dht_connection = 1; | 695 | int waiting_for_dht_connection = 1; |
696 | 696 | ||