Skip to content

Commit

Permalink
Try to open pihole.log a second time if failed first time
Browse files Browse the repository at this point in the history
  • Loading branch information
DL6ER committed Jun 28, 2017
1 parent 9976ff7 commit 47fd38c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ void open_pihole_log(void)
{
FILE * fp;
if((fp = fopen(files.log, "r")) == NULL) {
logg("FATAL: Opening of %s failed!", files.log);
logg(" Make sure it exists and is readable by user %s", username);
syslog(LOG_ERR, "Opening of pihole.log failed!");
// Return failure in exit status
exit(EXIT_FAILURE);
logg("WARN: Opening of %s failed!", files.log);
logg(" Make sure it exists and is readable by user %s\n Will try again in 15 seconds.", username);

sleepms(15000);
if((fp = fopen(files.log, "r")) == NULL) {
logg("FATAL: Opening of %s failed permanently!", files.log);
syslog(LOG_ERR, "Opening of pihole.log failed!");
// Return failure in exit status
exit(EXIT_FAILURE);
}
}
fclose(fp);
}
Expand Down

0 comments on commit 47fd38c

Please sign in to comment.