aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 16:35:42 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 16:35:42 +0000
commite3e2e1398a7d2fe1900ffe3251359ceaa92fe93c (patch)
tree1e62b4b1e8b878c2668c8b29efbe9e9d2a0d8aa4
parent46e553e7ac50359b77e8a4856320665e1c83fcdd (diff)
downloadpaludis-e3e2e1398a7d2fe1900ffe3251359ceaa92fe93c.tar.gz
paludis-e3e2e1398a7d2fe1900ffe3251359ceaa92fe93c.tar.xz
Distinguish between EOF on a read and an error.
-rw-r--r--paludis/util/pstream.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/paludis/util/pstream.cc b/paludis/util/pstream.cc
index afa23e3..4cd339c 100644
--- a/paludis/util/pstream.cc
+++ b/paludis/util/pstream.cc
@@ -57,8 +57,10 @@ PStreamInBuf::underflow()
gptr() - num_putback, num_putback);
ssize_t n = read(fd, buffer + putback_size, buffer_size - putback_size);
- if (n <= 0)
+ if (n == 0)
return EOF;
+ else if (n < 0)
+ throw PStreamError("read returned error " + stringify(strerror(errno)));
setg(buffer + putback_size - num_putback, buffer + putback_size,
buffer + putback_size + n);