mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-03 09:42:17 +00:00
Don't load the default config if a config file is specified on the command line.
This commit is contained in:
parent
b0bfd816d6
commit
0638155c37
5
main.c
5
main.c
@ -303,6 +303,7 @@ static struct block *blocks = NULL;
|
|||||||
static char *opt_kernel = NULL;
|
static char *opt_kernel = NULL;
|
||||||
|
|
||||||
static const char def_conf[] = "cgminer.conf";
|
static const char def_conf[] = "cgminer.conf";
|
||||||
|
static bool config_loaded = false;
|
||||||
|
|
||||||
#if defined(unix)
|
#if defined(unix)
|
||||||
static char *opt_stderr_cmd = NULL;
|
static char *opt_stderr_cmd = NULL;
|
||||||
@ -1753,6 +1754,7 @@ static char *load_config(const char *arg, void *unused)
|
|||||||
if (!json_is_object(config))
|
if (!json_is_object(config))
|
||||||
return "JSON decode of file failed";
|
return "JSON decode of file failed";
|
||||||
|
|
||||||
|
config_loaded = true;
|
||||||
/* Parse the config now, so we can override it. That can keep pointers
|
/* Parse the config now, so we can override it. That can keep pointers
|
||||||
* so don't free config object. */
|
* so don't free config object. */
|
||||||
return parse_config(config);
|
return parse_config(config);
|
||||||
@ -5672,7 +5674,8 @@ int main (int argc, char *argv[])
|
|||||||
opt_register_table(opt_cmdline_table,
|
opt_register_table(opt_cmdline_table,
|
||||||
"Options for command line only");
|
"Options for command line only");
|
||||||
|
|
||||||
load_default_config();
|
if (!config_loaded)
|
||||||
|
load_default_config();
|
||||||
|
|
||||||
opt_parse(&argc, argv, applog_and_exit);
|
opt_parse(&argc, argv, applog_and_exit);
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user