Skip to content

Commit

Permalink
Ensure -f option has precedence over settings file
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarlese committed May 17, 2021
1 parent 0e7740d commit e324972
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/filehelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,11 @@ int readSettingsFromJsonFile(char *settingsFileName, app_settings_t *settings,
&rates_filename)) {
assert(sizeof(settings->rates_filename) >
(long unsigned int)json_object_get_string_len(rates_filename));
memcpy(settings->rates_filename, json_object_get_string(rates_filename),
json_object_get_string_len(rates_filename) + 1);

if (strlen(settings->rates_filename) == 0)
memcpy(settings->rates_filename,
json_object_get_string(rates_filename),
json_object_get_string_len(rates_filename) + 1);

write_adv_log("settings->rates_filename: %s\n",
settings->rates_filename);
Expand Down
3 changes: 3 additions & 0 deletions src/phoebe.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,9 @@ int main(int argc, char **argv) {
signal(SIGTERM, handleSigint);
signal(SIGHUP, handleSighup);

bzero(&app_settings, sizeof(app_settings_t));
bzero(&system_settings, sizeof(tuning_params_t));

// set default verbosity setting before cmdline parsing, so
// that it can be used before
if (handleCommandLineArguments(argc, argv) == RET_FAIL)
Expand Down

0 comments on commit e324972

Please sign in to comment.