Skip to content

Commit

Permalink
Do not call init() if -n (dryrun) is set.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclksr committed Feb 10, 2021
1 parent 0264ad8 commit 678a6d8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ call_cfg_function(config_t *cfg, const char *fname, const devinfo_t *dev,
}

config_t *
open_cfg(const char *path)
open_cfg(const char *path, bool init)
{
config_t *cfg;

Expand All @@ -184,7 +184,8 @@ open_cfg(const char *path)
luaL_openlibs(cfg->luastate);
if (luaL_dofile(cfg->luastate, PATH_CFG_FILE) != 0)
diex("%s", lua_tostring(cfg->luastate, -1));
call_cfg_function(cfg, "init", NULL, NULL);
if (init)
call_cfg_function(cfg, "init", NULL, NULL);
cfg->exclude = getstrarr(cfg->luastate, "exclude_kmods",
&cfg->exclude_len);

Expand Down
2 changes: 1 addition & 1 deletion config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ typedef struct config_s {

extern int call_cfg_function(config_t *, const char *, const devinfo_t *,
const char *);
extern config_t *open_cfg(const char *);
extern config_t *open_cfg(const char *, bool);
#endif
2 changes: 1 addition & 1 deletion dsbdriverd.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ initcfg()
{
int i;

cfg = open_cfg(PATH_CFG_FILE);
cfg = open_cfg(PATH_CFG_FILE, !dryrun);
if (cfg == NULL)
return;
if (cfg->exclude == NULL)
Expand Down

0 comments on commit 678a6d8

Please sign in to comment.