From: Ruben Kerkhof Date: Sun, 5 Jun 2016 11:53:17 +0000 (+0200) Subject: swrite: return error if fd is negative X-Git-Tag: collectd-5.6.0~229^2 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;ds=sidebyside;h=d54f3b1640ee23b5213ac870ca3de558f54e8247;hp=de41631e3196258b3bcfa3267e82267c8c261e72;p=collectd.git swrite: return error if fd is negative --- diff --git a/src/daemon/common.c b/src/daemon/common.c index f82efe33..4c271d34 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -273,6 +273,9 @@ ssize_t swrite (int fd, const void *buf, size_t count) ptr = (const char *) buf; nleft = count; + if (fd < 0) + return (-1); + /* checking for closed peer connection */ pfd.fd = fd; pfd.events = POLLIN | POLLHUP;