fix buffer overflow for LONG lines in journal handling code for update requests.
[rrdtool.git] / src / rrd_update.c
index 563d7ac..c5917c0 100644 (file)
@@ -352,14 +352,14 @@ rrd_info_t *rrd_update_v(
     }
 
     opt_daemon = getenv (ENV_RRDCACHED_ADDRESS);
-    if (opt_daemon != NULL) {
+    if (opt_daemon != NULL && ! strcmp(opt_daemon,"")) {
         rrd_set_error ("The \"%s\" environment variable is defined, "
                 "but \"%s\" cannot work with rrdcached. Either unset "
                 "the environment variable or use \"update\" instead.",
                 ENV_RRDCACHED_ADDRESS, argv[0]);
         goto end_tag;
     }
-
+    
     /* need at least 2 arguments: filename, data. */
     if (argc - optind < 2) {
         rrd_set_error("Not enough arguments");
@@ -429,7 +429,10 @@ int rrd_update(
 
     {   /* try to connect to rrdcached */
         int status = rrdc_connect(opt_daemon);
-        if (status != 0) return status;
+        if (status != 0) {        
+             rc = status;           
+             goto out;           
+        }        
     }
 
     if ((tmplt != NULL) && rrdc_is_connected(opt_daemon))