mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Check if key file was opened correctly in DHT_bootstrap.c
Warn the user if it wasn't.
This commit is contained in:
parent
1c3f88758d
commit
ee0f06937f
|
@ -83,6 +83,11 @@ void manage_keys(DHT *dht)
|
|||
memcpy(keys + crypto_box_PUBLICKEYBYTES, dht->self_secret_key, crypto_box_SECRETKEYBYTES);
|
||||
keys_file = fopen("key", "w");
|
||||
|
||||
if (keys_file == NULL) {
|
||||
printf("Error opening key file in write mode.\nKeys will not be saved.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fwrite(keys, sizeof(uint8_t), KEYS_SIZE, keys_file) != KEYS_SIZE) {
|
||||
printf("Error while writing the key file.\nExiting.\n");
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user