Skip to content

Commit

Permalink
make nc_test_conf return bool
Browse files Browse the repository at this point in the history
  • Loading branch information
Manju Rajashekhar committed Jan 25, 2013
1 parent 4632567 commit dcef149
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/nc.c
Expand Up @@ -430,7 +430,11 @@ nc_get_options(int argc, char **argv, struct instance *nci)
return NC_OK;
}

static int
/*
* Returns true if configuration file has a valid syntax, otherwise
* returns false
*/
static bool
nc_test_conf(struct instance *nci)
{
struct conf *cf;
Expand All @@ -439,14 +443,14 @@ nc_test_conf(struct instance *nci)
if (cf == NULL) {
log_stderr("nutcracker: configuration file '%s' syntax is invalid",
nci->conf_filename);
return 1;
return false;
}

conf_destroy(cf);

log_stderr("nutcracker: configuration file '%s' syntax is ok",
nci->conf_filename);
return 0;
return true;
}

static rstatus_t
Expand Down Expand Up @@ -549,7 +553,10 @@ main(int argc, char **argv)
}

if (test_conf) {
exit(nc_test_conf(&nci));
if (!nc_test_conf(&nci)) {
exit(1);
}
exit(0);
}

status = nc_pre_run(&nci);
Expand Down

0 comments on commit dcef149

Please sign in to comment.