diff --git a/src/io.c b/src/io.c
index 5c99a29575ee720579f86b8925f40b4743d372bf..d5d4cbdcf8eed6974d9c7f1dd999aaaf9723b24a 100644
--- a/src/io.c
+++ b/src/io.c
@@ -227,7 +227,10 @@ static int do_read(struct abstract_read **r, UINT32 length, UINT8 *buffer)
     {
       int res = read(closure->fd, buffer, length);
       if (!res)
-	return A_EOF;
+	{
+	  debug("Read EOF on fd %d.\n", closure->fd);
+	  return A_EOF;
+	}
       if (res > 0)
 	return res;