From 187486aee56dfacf6478d412c9385cb6b17a6193 Mon Sep 17 00:00:00 2001 From: Arne Juul Date: Thu, 5 Oct 2017 07:25:53 +0000 Subject: fix logic * missing directory gives ENOENT * cannot get config just after subscribe, must do nextConfig() first --- logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'logforwarder/src') diff --git a/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp b/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp index b4b4bdbc7f2..e34a83030e8 100644 --- a/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp +++ b/logforwarder/src/apps/vespa-logforwarder-start/cf-handler.cpp @@ -30,11 +30,12 @@ cfFilePath() { std::string path = vespa::Defaults::underVespaHome("var/db/vespa/splunk"); DIR *dp = opendir(path.c_str()); if (dp == NULL) { - if (errno != ENOTDIR || mkdir(path.c_str(), 0755) != 0) { + if (errno != ENOENT || mkdir(path.c_str(), 0755) != 0) { perror(path.c_str()); } + } else { + closedir(dp); } - if (dp != NULL) closedir(dp); path += "/deploymentclient.conf"; return path; } @@ -77,7 +78,6 @@ CfHandler::start(const char *configId) LOG(debug, "Reading configuration with id '%s'", configId); try { subscribe(configId, CONFIG_TIMEOUT_MS); - doConfigure(); } catch (config::ConfigTimeoutException & ex) { LOG(warning, "Timout getting config, please check your setup. Will exit and restart: %s", ex.getMessage().c_str()); exit(EXIT_FAILURE); -- cgit v1.2.3