Fix logic for detecting conf files.

The logic for detecting if a file exists was backwards. It would treat a
file as existing if it could *not* be opened. Reverse that logic so it
works.

This fixes https://github.com/draios/falco/issues/135.
This commit is contained in:
Mark Stemm 2016-10-14 13:15:37 -07:00
parent 5f9f5c47d1
commit ae7f5eb631

View File

@ -337,14 +337,14 @@ int falco_init(int argc, char **argv)
else else
{ {
conf_stream.open(FALCO_SOURCE_CONF_FILE); conf_stream.open(FALCO_SOURCE_CONF_FILE);
if (!conf_stream.is_open()) if (conf_stream.is_open())
{ {
conf_filename = FALCO_SOURCE_CONF_FILE; conf_filename = FALCO_SOURCE_CONF_FILE;
} }
else else
{ {
conf_stream.open(FALCO_INSTALL_CONF_FILE); conf_stream.open(FALCO_INSTALL_CONF_FILE);
if (!conf_stream.is_open()) if (conf_stream.is_open())
{ {
conf_filename = FALCO_INSTALL_CONF_FILE; conf_filename = FALCO_INSTALL_CONF_FILE;
} }