Permalink
Browse files

Merge pull request #58 from Cofyc/checkconf

exit 1 if configuration file is invalid
  • Loading branch information...
2 parents 8a7096c + 462e0cf commit 4632567bfcb3ba90e2c46d01fbe622b263faecec Manju Rajashekhar committed Jan 25, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/nc.c
View
@@ -430,7 +430,7 @@ nc_get_options(int argc, char **argv, struct instance *nci)
return NC_OK;
}
-static void
+static int
nc_test_conf(struct instance *nci)
{
struct conf *cf;
@@ -439,13 +439,14 @@ nc_test_conf(struct instance *nci)
if (cf == NULL) {
log_stderr("nutcracker: configuration file '%s' syntax is invalid",
nci->conf_filename);
- return;
+ return 1;
}
conf_destroy(cf);
log_stderr("nutcracker: configuration file '%s' syntax is ok",
nci->conf_filename);
+ return 0;
}
static rstatus_t
@@ -548,8 +549,7 @@ main(int argc, char **argv)
}
if (test_conf) {
- nc_test_conf(&nci);
- exit(0);
+ exit(nc_test_conf(&nci));
}
status = nc_pre_run(&nci);

0 comments on commit 4632567

Please sign in to comment.