]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
ceph plugin: Initialize file descriptor to -1. 3459/head
authorFlorian Forster <octo@collectd.org>
Mon, 11 May 2020 14:08:48 +0000 (16:08 +0200)
committerFlorian Forster <octo@collectd.org>
Mon, 11 May 2020 14:18:17 +0000 (16:18 +0200)
(struct cconn).asok was implicitly initialized to zero. If connecting to
a ceph daemon failed, the field would be left unmodified and
cconn_close() would eventually close file descriptor 0.

src/ceph.c

index 8048f5ddcfce7e7eb57460f54b90da4d75e1d8bf..aed660a8e295d71d8b0284d92d10c1d51da3d084 100644 (file)
@@ -1326,6 +1326,7 @@ static ssize_t cconn_main_loop(uint32_t request_type) {
         .d = g_daemons[i],
         .request_type = request_type,
         .state = CSTATE_UNCONNECTED,
+        .asok = -1,
     };
   }