about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/s6-portable-utils/s6-head.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/s6-portable-utils/s6-head.c b/src/s6-portable-utils/s6-head.c
index de7d937..fc5f8f9 100644
--- a/src/s6-portable-utils/s6-head.c
+++ b/src/s6-portable-utils/s6-head.c
@@ -65,6 +65,7 @@ static int head_safedolines (int fd, size_t lines)
     errno = 0 ;
     r = allread(fd, tmp, lines) ;
     if (r < lines && errno) return 0 ;
+    if (!r) break ;
     lines -= byte_count(tmp, r, '\n') ;
     if (buffer_put(buffer_1, tmp, r) < (ssize_t)r) return 0 ;
   }