src/rrd_dump.c: Rename the `rrdcached' variable to `opt_daemon'.
[rrdtool.git] / src / rrd_client.c
index d9a7468..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;