Better code style to remove warnings
This commit is contained in:
parent
d4b5a20c17
commit
318b447cb9
2 changed files with 12 additions and 4 deletions
|
@ -86,8 +86,16 @@ keypair_t *get_keypair(char *username)
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t pk[PK_SIZE], sk[SK_SIZE];
|
uint8_t pk[PK_SIZE], sk[SK_SIZE];
|
||||||
fread(pk, 1, PK_SIZE, keyf);
|
size_t bytes_read;
|
||||||
fread(sk, 1, SK_SIZE, keyf);
|
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);
|
fclose(keyf);
|
||||||
|
|
||||||
keypair_t *kp = memalloc(sizeof(keypair_t));
|
keypair_t *kp = memalloc(sizeof(keypair_t));
|
||||||
|
|
|
@ -94,11 +94,11 @@ void mkdir_p(const char *file)
|
||||||
snprintf(path, PATH_MAX, "%s%s", home, file + 1);
|
snprintf(path, PATH_MAX, "%s%s", home, file + 1);
|
||||||
} else {
|
} else {
|
||||||
strcpy(path, file);
|
strcpy(path, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fix first / not appearing in the string */
|
/* fix first / not appearing in the string */
|
||||||
if (path[0] == '/')
|
if (path[0] == '/')
|
||||||
strcat(dir_path, "/");
|
strcat(dir_path, "/");
|
||||||
|
|
||||||
/* Find last occurrence of '/' */
|
/* Find last occurrence of '/' */
|
||||||
char *last_slash = strrchr(path, '/');
|
char *last_slash = strrchr(path, '/');
|
||||||
|
|
Loading…
Reference in a new issue