From 57e684911b1948f780cd9d7409050aedf2bc6dd8 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 21 Aug 2019 17:18:30 -0400 Subject: [PATCH] common/ConfUtils: do not throw exception when querying file status The "fs::is_other" call was throwing a "fs::filesystem_error" if the configuration file was not able to be accessed. This should fail gracefully. Signed-off-by: Jason Dillaman --- src/common/ConfUtils.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index 96c9f352da9..70367c09315 100644 --- a/src/common/ConfUtils.cc +++ b/src/common/ConfUtils.cc @@ -122,7 +122,9 @@ int ConfFile::parse_file(const std::string &fname, return -EINVAL; } } catch (const fs::filesystem_error& e) { - if (fs::is_other(fname)) { + std::error_code ec; + auto is_other = fs::is_other(fname, ec); + if (!ec && is_other) { // /dev/null? return 0; } else { -- 2.39.5