X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdaemon%2Fcommon.c;h=4c271d347d90e9d3bc60a50b5b528939eea2b235;hb=3f8fcdf9a0184e2e2cb3098a94f0223cf54373d4;hp=546da3b3f240e94d019e15d20036fca20755fa16;hpb=0d80072344ea5322c34f716ed77a5319a62bfc96;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;