From 6b3bcf8fdba6115766d7cb170ff5328038c7383c Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 11 Feb 2007 12:39:22 +0100 Subject: [PATCH] plugin.c: Catch NULL-pointers and fix it or ignore the values. Some systems, such as Solaris, cannot handle NULL-pointers being passed to `printf ("%s", NULL);' or the like. This caused a crash when sending the users plugin's values over the network under Solaris. --- src/plugin.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugin.c b/src/plugin.c index 46a1c617..d708b6bc 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -375,6 +375,18 @@ void plugin_write (char *host, char *type, char *inst, char *val) */ void plugin_submit (char *type, char *inst, char *val) { + if (inst == NULL) + inst = "-"; + + if ((type == NULL) || (val == NULL)) + { + DBG ("Help! NULL-pointer! type = %s; inst = %s; val = %s;", + (type == NULL) ? "(null)" : type, + inst, + (val == NULL) ? "(null)" : val); + return; + } + if (operating_mode == MODE_CLIENT) network_send (type, inst, val); else -- 2.30.2