[PATCH 3/3] logging: fix endless loop on EOF