X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcommon.c;h=4c271d347d90e9d3bc60a50b5b528939eea2b235;hb=d54f3b1640ee23b5213ac870ca3de558f54e8247;hp=f82efe3347d0cf292a8177120d6d2c3ea1d88242;hpb=711755016ddb3b8e3d34cc05857d71e186a85cd0;p=collectd.git 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;