diff options
author | Jim Meyering <jim@meyering.net> | 2002-12-01 17:04:35 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-12-01 17:04:35 +0000 |
commit | 32b9f22700688d7da6dc24967f41736a830d6cca (patch) | |
tree | bc40a29f63f85be220603dfaf39788900797e158 /lib | |
parent | 0937f50e9e193bba8e981d48741a9ce0a05f51f4 (diff) | |
download | coreutils-32b9f22700688d7da6dc24967f41736a830d6cca.tar.xz |
(safe_read): Also exit the loop when read returns zero.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/safe-read.c | 2 |
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 |