diff --git a/src/common.c b/src/common.c
index 98e670443810b844a9dcc2f47615fc23921556a9..5487b326fd34ac31eb8adfe20fa6971ecd0c4fec 100644 (file)
--- a/src/common.c
+++ b/src/common.c
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;