[PATCH] Added large file support ("backported" to collectd-3).
[collectd.git] / src / common.c
index 98e6704..e7d561f 100644 (file)
  *   Niki W. Waibel <niki.waibel@gmx.net>
 **/
 
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include "common.h"
 #include "utils_debug.h"
 
@@ -144,6 +148,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;