From: Florian Forster Date: Mon, 11 May 2020 14:08:48 +0000 (+0200) Subject: ceph plugin: Initialize file descriptor to -1. X-Git-Tag: collectd-5.12.0~6^2^2~1^2^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebb55faa02862943194ece904236a10200125c95;p=thirdparty%2Fcollectd.git ceph plugin: Initialize file descriptor to -1. (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. --- diff --git a/src/ceph.c b/src/ceph.c index 8048f5ddc..aed660a8e 100644 --- a/src/ceph.c +++ b/src/ceph.c @@ -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, }; }