]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common/ConfUtils: do not throw exception when querying file status
authorJason Dillaman <dillaman@redhat.com>
Wed, 21 Aug 2019 21:18:30 +0000 (17:18 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 22 Aug 2019 12:04:44 +0000 (08:04 -0400)
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 <dillaman@redhat.com>
src/common/ConfUtils.cc

index 96c9f352da9ae4b2390ab9bc5a6889796f160ed5..70367c0931536b19acd95b8743d7b7776e717f22 100644 (file)
@@ -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 {