add check for empty hosts' list
This commit is contained in:
parent
bc7c1edb41
commit
ab22d61262
8
yasnd.c
8
yasnd.c
@ -63,8 +63,14 @@ void init()
|
|||||||
log_event("Error parsing config file");
|
log_event("Error parsing config file");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
// allocate memory for hosts array...
|
// hosts' array must not be empty
|
||||||
hosts_count=cfg_size(cfg,"hosts");
|
hosts_count=cfg_size(cfg,"hosts");
|
||||||
|
if (hosts_count==0)
|
||||||
|
{
|
||||||
|
log_event("Error: no hosts to check defined in config file");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
// allocate memory for hosts array...
|
||||||
hosts=allocate_memory(hosts_count*sizeof(host_decl));
|
hosts=allocate_memory(hosts_count*sizeof(host_decl));
|
||||||
// ...and fill it with config file content
|
// ...and fill it with config file content
|
||||||
for (int i=0;i<hosts_count;i++)
|
for (int i=0;i<hosts_count;i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user