Code

irq plugin: close file descriptor on failure
[collectd.git] / src / ceph.c
index 419ca6e56170758c5c05dea2e1e20994b53b2ff3..c0df37597cb9ad145dcfbb9cf29f0216e770292e 100644 (file)
@@ -1082,6 +1082,7 @@ static int cconn_connect(struct cconn *io)
     {
         ERROR("ceph plugin: cconn_connect: connect(%d) failed: error %d",
             fd, err);
+        close(fd);
         return err;
     }
 
@@ -1091,6 +1092,7 @@ static int cconn_connect(struct cconn *io)
         err = -errno;
         ERROR("ceph plugin: cconn_connect: fcntl(%d, O_NONBLOCK) error %d",
             fd, err);
+        close(fd);
         return err;
     }
     io->asok = fd;