diff options
Diffstat (limited to 'other/DHT_bootstrap.c')
-rw-r--r-- | other/DHT_bootstrap.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 462360c3..29aa5bcf 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c | |||
@@ -83,6 +83,11 @@ void manage_keys(DHT *dht) | |||
83 | memcpy(keys + crypto_box_PUBLICKEYBYTES, dht->self_secret_key, crypto_box_SECRETKEYBYTES); | 83 | memcpy(keys + crypto_box_PUBLICKEYBYTES, dht->self_secret_key, crypto_box_SECRETKEYBYTES); |
84 | keys_file = fopen("key", "w"); | 84 | keys_file = fopen("key", "w"); |
85 | 85 | ||
86 | if (keys_file == NULL) { | ||
87 | printf("Error opening key file in write mode.\nKeys will not be saved.\n"); | ||
88 | return; | ||
89 | } | ||
90 | |||
86 | if (fwrite(keys, sizeof(uint8_t), KEYS_SIZE, keys_file) != KEYS_SIZE) { | 91 | if (fwrite(keys, sizeof(uint8_t), KEYS_SIZE, keys_file) != KEYS_SIZE) { |
87 | printf("Error while writing the key file.\nExiting.\n"); | 92 | printf("Error while writing the key file.\nExiting.\n"); |
88 | exit(1); | 93 | exit(1); |