Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not report errors for configuration file errors. #162

Merged
merged 3 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/kiwi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,15 @@ bool KiwiDB::ParseArgs(int argc, char* argv[]) {
{"slaveof", required_argument, 0, 's'}, {"redis-compatible-mode", no_argument, 0, 'c'},
};
// kiwi [/path/to/kiwi.conf] [options]
if (options_.GetConfigName().empty() && argc > 1 && ::access(argv[1], R_OK) == 0) {
options_.SetConfigName(argv[1]);
argc = argc - 1;
argv = argv + 1;
if (options_.GetConfigName().empty() && argc > 1) {
if (::access(argv[1], R_OK) == 0) {
options_.SetConfigName(argv[1]);
argc = argc - 1;
argv = argv + 1;
} else {
std::cerr << "Configuration file [" << argv[1] << "] is not accessible or dose not exist.\n";
return false;
}
}
while (1) {
int this_option_optind = optind ? optind : 1;
Expand Down
Loading