rrdcached(1): Document which commands are aware of the daemon.
[rrdtool.git] / src / rrd_client.c
index 4449a01..f1253f8 100644 (file)
@@ -99,7 +99,11 @@ static ssize_t swrite (const void *buf, size_t count) /* {{{ */
       continue;
 
     if (status < 0)
+    {
+      close (sd);
+      sd = -1;
       return (status);
+    }
 
     nleft = nleft - status;
     ptr   = ptr   + status;
@@ -178,8 +182,7 @@ static int rrdc_connect_unix (const char *path) /* {{{ */
   struct sockaddr_un sa;
   int status;
 
-  if (path == NULL)
-    path = RRDD_SOCK_PATH;
+  assert (path != NULL);
 
   pthread_mutex_lock (&lock);
 
@@ -222,7 +225,7 @@ int rrdc_connect (const char *addr) /* {{{ */
   int status;
 
   if (addr == NULL)
-    addr = RRDD_SOCK_PATH;
+    addr = RRDCACHED_DEFAULT_ADDRESS;
 
   if (strncmp ("unix:", addr, strlen ("unix:")) == 0)
     return (rrdc_connect_unix (addr + strlen ("unix:")));
@@ -246,7 +249,7 @@ int rrdc_connect (const char *addr) /* {{{ */
   ai_hints.ai_socktype = SOCK_STREAM;
 
   ai_res = NULL;
-  status = getaddrinfo (addr, DEFAULT_PORT, &ai_hints, &ai_res);
+  status = getaddrinfo (addr, RRDCACHED_DEFAULT_PORT, &ai_hints, &ai_res);
   if (status != 0)
   {
     pthread_mutex_unlock (&lock);