From e63b3a0f4e9c9cf74766daf42855a718233fb3ca Mon Sep 17 00:00:00 2001 From: vraatikka Date: Tue, 23 Jul 2013 09:11:10 +0300 Subject: [PATCH] Added support for blanks between '-c' and config file name --- core/gateway.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/gateway.c b/core/gateway.c index e188cf10c..61921b6c8 100644 --- a/core/gateway.c +++ b/core/gateway.c @@ -306,10 +306,21 @@ char ddopt[1024]; } if (strncmp(argv[n], "-c", 2) == 0) { - cnf_file = &argv[n][2]; - } - } - + int s=2; + + while (argv[n][s] == 0 && s<10) s++; + + if (s==10) { + skygw_log_write( + NULL, LOGFILE_ERROR, + "Fatal : missing file name. \n" + "Unable to find a MaxScale configuration file, either " + "install one in /etc/MaxScale.cnf, $MAXSCALE_HOME/etc/MaxScale.cnf " + "or use the -c option with configuration file name. Exiting.\n"); + } + cnf_file = &argv[n][s]; + } + } if (cnf_file == NULL) { skygw_log_write(