From 26f1864c1f2a5b71faa13eaeebff9193aed94ac4 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Tue, 24 Mar 2009 23:10:51 +0100 Subject: [PATCH] Don't crash if one specify '-S' or '-s' and an invalid configuration file. --- src/main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index d398bdd..42d387e 100644 --- a/src/main.c +++ b/src/main.c @@ -167,21 +167,22 @@ int check_configuration(int dump) { struct hub_config configuration; int ret = read_config(arg_config, &configuration, 0); - + if (dump) { - dump_config(&configuration, dump > 1); - puts(""); - } - - if (dump) + if (ret != -1) + { + dump_config(&configuration, dump > 1); + } return 0; - + } + if (ret == -1) { fprintf(stderr, "ERROR\n"); return 1; } + fprintf(stdout, "OK\n"); return 0; }