Skip to content

Commit dc51a70

Browse files
authored
Merge pull request #8558 from FirebirdSQL/work/gh-8523
Avoid exception when firebird.conf is missing.
2 parents 924897f + 1de0b81 commit dc51a70

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/common/config/config.cpp

+8-12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "../common/classes/init.h"
2828
#include "../common/dllinst.h"
2929
#include "../common/os/fbsyslog.h"
30+
#include "../common/os/path_utils.h"
3031
#include "../common/utils_proto.h"
3132
#include "../jrd/constants.h"
3233
#include "firebird/Interface.h"
@@ -60,22 +61,17 @@ class ConfigImpl : public Firebird::PermanentStorage
6061
explicit ConfigImpl(Firebird::MemoryPool& p)
6162
: Firebird::PermanentStorage(p), missConf(false)
6263
{
63-
try
64+
const auto fullName = fb_utils::getPrefix(Firebird::IConfigManager::DIR_CONF, Firebird::CONFIG_FILE);
65+
missConf = !PathUtils::canAccess(fullName, 0);
66+
67+
if (missConf)
6468
{
65-
ConfigFile file(fb_utils::getPrefix(Firebird::IConfigManager::DIR_CONF, Firebird::CONFIG_FILE),
66-
ConfigFile::ERROR_WHEN_MISS);
69+
ConfigFile file(ConfigFile::USE_TEXT, "");
6770
defaultConfig = FB_NEW Firebird::Config(file);
6871
}
69-
catch (const Firebird::status_exception& ex)
72+
else
7073
{
71-
if (ex.value()[1] != isc_miss_config)
72-
{
73-
throw;
74-
}
75-
76-
missConf = true;
77-
78-
ConfigFile file(ConfigFile::USE_TEXT, "");
74+
ConfigFile file(fullName, ConfigFile::ERROR_WHEN_MISS);
7975
defaultConfig = FB_NEW Firebird::Config(file);
8076
}
8177
}

0 commit comments

Comments
 (0)