Include error code if changing of directory is not successful

This commit is contained in:
DL6ER 2017-02-08 13:02:31 +01:00
parent eaf5c569fb
commit fcc90aa126
No known key found for this signature in database
GPG Key ID: BB8EC0BC77973A30
1 changed files with 2 additions and 2 deletions

View File

@ -79,9 +79,9 @@ void go_daemon(void)
savepid(sid);
// Change the current working directory to root.
if(!chdir("/etc/pihole"))
if(chdir("/etc/pihole") != 0)
{
logg("FATAL: Cannot change directory to /etc/pihole");
logg_int("FATAL: Cannot change directory to /etc/pihole. Error code ",errno);
// Return failure
exit(1);
}