1
0

In main check for addressbok file open errors.

This commit is contained in:
Alexander Andreev 2024-03-28 18:04:46 +04:00
parent d95b4c3089
commit fa589f3122
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34

View File

@ -4,6 +4,7 @@
#include "net.h" #include "net.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h>
#define CHANNELS 1 #define CHANNELS 1
#define SAMPLE_RATE 48000 #define SAMPLE_RATE 48000
@ -24,6 +25,10 @@ int main(int argc, char **argv) {
addrbook_t ab = {0}; addrbook_t ab = {0};
FILE *in = fopen("addressbook_key", "r"); FILE *in = fopen("addressbook_key", "r");
if (in == NULL) {
fprintf(stderr, "An addressbook file wasn't open: %s\n", strerror(errno));
return 1;
}
addrbook_load(&ab, in); addrbook_load(&ab, in);