]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Return success for rrdcached pending on empty (#809)
authorSteven Hartland <steven.hartland@multiplay.co.uk>
Fri, 21 Jul 2017 06:20:58 +0000 (07:20 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Fri, 21 Jul 2017 06:20:58 +0000 (02:20 -0400)
If we have no pending entries for a file return success with no entries instead of returning an error.

src/rrd_daemon.c

index c37865dfe69d89f944088aa8c1f10bd5d5b8c752..6092317bc35e3b0cf21155346a848ac895852292 100644 (file)
@@ -1485,28 +1485,19 @@ static int handle_request_pending(HANDLER_PROTO) /* {{{ */
     return syntax_error(sock,cmd);
 
   file = get_abs_path(pbuffile);
-  if (file == NULL) {
-    rc = send_response(sock, RESP_ERR, "%s\n", rrd_strerror(ENOMEM));
-    goto done;
-  }
+  if (file == NULL)
+    return send_response(sock, RESP_ERR, "%s\n", rrd_strerror(ENOMEM));
 
   pthread_mutex_lock(&cache_lock);
   ci = g_tree_lookup(cache_tree, file);
-  if (ci == NULL)
-  {
-    pthread_mutex_unlock(&cache_lock);
-    rc = send_response(sock, RESP_ERR, "%s\n", rrd_strerror(ENOENT));
-    goto done;
+  if (ci != NULL) {
+    for (size_t i=0; i < ci->values_num; i++)
+      add_response_info(sock, "%s\n", ci->values[i]);
   }
 
-  for (size_t i=0; i < ci->values_num; i++)
-    add_response_info(sock, "%s\n", ci->values[i]);
-
-  pthread_mutex_unlock(&cache_lock);
-  rc = send_response(sock, RESP_OK, "updates pending\n");
-done:
   free(file);
-  return rc;
+  pthread_mutex_unlock(&cache_lock);
+  return send_response(sock, RESP_OK, "updates pending\n");
 } /* }}} static int handle_request_pending */
 
 static int handle_request_forget(HANDLER_PROTO) /* {{{ */