From: Jason Dillaman Date: Wed, 21 Aug 2019 21:18:30 +0000 (-0400) Subject: common/ConfUtils: do not throw exception when querying file status X-Git-Tag: v15.1.0~1773^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=57e684911b1948f780cd9d7409050aedf2bc6dd8;p=ceph.git 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 --- diff --git a/src/common/ConfUtils.cc b/src/common/ConfUtils.cc index 96c9f352da9a..70367c093153 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 {