X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fcommon.c;h=4c271d347d90e9d3bc60a50b5b528939eea2b235;hb=d54f3b1640ee23b5213ac870ca3de558f54e8247;hp=546da3b3f240e94d019e15d20036fca20755fa16;hpb=b5a33aab585aabef83c79bf3261092ca901edf9c;p=collectd.git diff --git a/src/daemon/common.c b/src/daemon/common.c index 546da3b3..4c271d34 100644 --- a/src/daemon/common.c +++ b/src/daemon/common.c @@ -36,9 +36,7 @@ #include "plugin.h" #include "utils_cache.h" -#if HAVE_PTHREAD_H -# include -#endif +#include #ifdef HAVE_MATH_H # include @@ -275,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;