summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-12-01 17:04:35 +0000
committerJim Meyering <jim@meyering.net>2002-12-01 17:04:35 +0000
commit32b9f22700688d7da6dc24967f41736a830d6cca (patch)
treebc40a29f63f85be220603dfaf39788900797e158 /lib
parent0937f50e9e193bba8e981d48741a9ce0a05f51f4 (diff)
downloadcoreutils-32b9f22700688d7da6dc24967f41736a830d6cca.tar.xz
(safe_read): Also exit the loop when read returns zero.
Diffstat (limited to 'lib')
-rw-r--r--lib/safe-read.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/safe-read.c b/lib/safe-read.c
index c189eb1a6..75ac7bf31 100644
--- a/lib/safe-read.c
+++ b/lib/safe-read.c
@@ -78,6 +78,8 @@ safe_read (int fd, void *buf, size_t count)
nbytes_to_read = MAX_BYTES_TO_READ & ~8191;
result = read (fd, ptr, nbytes_to_read);
+ if (result == 0)
+ break;
if (result < 0)
{
#ifdef EINTR