Permalink
Browse files

make nc_test_conf return bool

  • Loading branch information...
1 parent 4632567 commit dcef14940cca833bcb89701bab3c9a52ed5269d4 Manju Rajashekhar committed Jan 25, 2013
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/nc.c
View
@@ -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;
@@ -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
@@ -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);

0 comments on commit dcef149

Please sign in to comment.