From ae7f5eb631d2a8436d93199a9eb2d1f23719bd9e Mon Sep 17 00:00:00 2001 From: Mark Stemm Date: Fri, 14 Oct 2016 13:15:37 -0700 Subject: [PATCH] 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. --- userspace/falco/falco.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/userspace/falco/falco.cpp b/userspace/falco/falco.cpp index 8fbc315839e..e0e241e4546 100644 --- a/userspace/falco/falco.cpp +++ b/userspace/falco/falco.cpp @@ -337,14 +337,14 @@ int falco_init(int argc, char **argv) else { conf_stream.open(FALCO_SOURCE_CONF_FILE); - if (!conf_stream.is_open()) + if (conf_stream.is_open()) { conf_filename = FALCO_SOURCE_CONF_FILE; } else { conf_stream.open(FALCO_INSTALL_CONF_FILE); - if (!conf_stream.is_open()) + if (conf_stream.is_open()) { conf_filename = FALCO_INSTALL_CONF_FILE; }