Better code style to remove warnings

This commit is contained in:
Night Kaly 2024-09-25 11:00:39 +01:00
parent d4b5a20c17
commit 318b447cb9
Signed by: night0721
GPG key ID: 957D67B8DB7A119B
2 changed files with 12 additions and 4 deletions

View file

@ -86,8 +86,16 @@ keypair_t *get_keypair(char *username)
}
uint8_t pk[PK_SIZE], sk[SK_SIZE];
fread(pk, 1, PK_SIZE, keyf);
fread(sk, 1, SK_SIZE, keyf);
size_t bytes_read;
bytes_read = fread(pk, 1, PK_SIZE, keyf);
if (bytes_read != PK_SIZE) {
error(1, "Error reading public key from file, bytes_read(%zu)!=%d", bytes_read, PK_SIZE);
}
bytes_read = fread(sk, 1, SK_SIZE, keyf);
if (bytes_read != SK_SIZE) {
error(1, "Error reading secret key from file, bytes_read(%zu)!=%d", bytes_read, SK_SIZE);
}
fclose(keyf);
keypair_t *kp = memalloc(sizeof(keypair_t));