src/rrd_client.c: Close the socket if writing to it fails.
authorFlorian Forster <octo@verplant.org>
Thu, 3 Jul 2008 09:17:59 +0000 (11:17 +0200)
committerFlorian Forster <octo@verplant.org>
Thu, 3 Jul 2008 09:17:59 +0000 (11:17 +0200)
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;