Code

sensors plugin: Improved the documentation in the sample configfile and the `collectd...
[collectd.git] / src / common.c
index 98e670443810b844a9dcc2f47615fc23921556a9..5487b326fd34ac31eb8adfe20fa6971ecd0c4fec 100644 (file)
@@ -144,6 +144,15 @@ ssize_t sread (int fd, void *buf, size_t count)
                if (status < 0)
                        return (status);
 
+               if (status == 0)
+               {
+                       DBG ("Received EOF from fd %i. "
+                                       "Closing fd and returning error.",
+                                       fd);
+                       close (fd);
+                       return (-1);
+               }
+
                assert (nleft >= status);
 
                nleft = nleft - status;