Changed admin list configuration behavior

This commit is contained in:
fall-leaf 2023-08-03 15:40:59 +03:00
parent 399eb45986
commit 5812a15092

View File

@ -202,14 +202,15 @@ parse_admin_list(char const * admin_list_path)
char * line = NULL; char * line = NULL;
size_t nread = 0; size_t nread = 0;
admins = calloc(ADMIN_LIST_INIT_SIZE, sizeof(char *));
stream = fopen(admin_list_path, "r"); stream = fopen(admin_list_path, "r");
if (stream == NULL) if (stream == NULL)
{ {
PERROR(1); /* Pretty valid case I guess? No admin file = no admins, maybe all configuration is performed locally */
return 0;
} }
admins = calloc(ADMIN_LIST_INIT_SIZE, sizeof(char *));
while (getline(&line, &nread, stream) > 0) while (getline(&line, &nread, stream) > 0)
{ {
if (++lines_read > current_array_size) if (++lines_read > current_array_size)