@@ -246,6 +246,11 @@ static void *server_progress_thread (void *data)
if (!prog) {
ERROR("Fatal Error: thread without data !");
}
+ if (!prog->url || !strlen(prog->url)) {
+ INFO("No url for logging...no result sent");
+ pthread_exit((void *)SERVER_EINIT);
+ }
+
channel = channel_new();
if (!channel) {
ERROR("Cannot get channel for communication");
@@ -255,11 +260,6 @@ static void *server_progress_thread (void *data)
pthread_exit((void *)SERVER_EINIT);
}
- if (!prog->url || !strlen(prog->url)) {
- INFO("No url for logging...no result sent");
- pthread_exit((void *)SERVER_EINIT);
- }
-
if(prog->fname)
read_module_settings(prog->fname, "gservice.logevent", server_logevent_settings,
&fmtevents);
@@ -370,6 +370,9 @@ static char *server_prepare_query(char *url, struct dict *dict)
cleanup:
curl_easy_cleanup(curl);
+ if (!qry)
+ qry = url;
+
return qry;
}
@@ -629,7 +632,7 @@ server_op_res_t server_start(char *fname, int argc, char *argv[])
}
if (mandatory_argument_count != ALL_MANDATORY_SET) {
- fprintf(stderr, "Mandatory arguments missing!\n");
+ ERROR("Mandatory arguments missing!");
suricatta_print_help();
return SERVER_EINIT;
}
@@ -648,7 +651,7 @@ server_op_res_t server_start(char *fname, int argc, char *argv[])
return SERVER_EINIT;
}
- progdata.fname = strdup(fname);
+ progdata.fname = (fname) ? strdup(fname) : NULL;
progdata.url = server_general.logurl;
progdata.identify = &server_general.configdata;
If no configuration data is passed, the server crashes (strdup called with NULL argument). Without configuration file, no identify data can be retrieved: the identify data is used to format the query string to the server, that results Null. This is not correct and the URL is set to the one passed via command line. Signed-off-by: Stefano Babic <sbabic@denx.de> --- suricatta/server_general.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)