diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-26 16:16:08 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-02-26 16:16:08 +0100 |
commit | 581e1bc5b45c7bbe227dbc5b35b60ca37efe059f (patch) | |
tree | 4cf2ed7ff0cc6eef1eb4b46fb206d59e0116a304 /src/libutil/serialise.cc | |
parent | bcc9943cee4d4f62e0bceb4245d390fb60744eae (diff) |
FdSource: track number of bytes read
Diffstat (limited to 'src/libutil/serialise.cc')
-rw-r--r-- | src/libutil/serialise.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc index c9620e2bf..a3cd4ff0d 100644 --- a/src/libutil/serialise.cc +++ b/src/libutil/serialise.cc @@ -64,9 +64,9 @@ static void warnLargeDump() void FdSink::write(const unsigned char * data, size_t len) { + written += len; static bool warned = false; if (warn && !warned) { - written += len; if (written > threshold) { warnLargeDump(); warned = true; @@ -131,6 +131,7 @@ size_t FdSource::readUnbuffered(unsigned char * data, size_t len) } while (n == -1 && errno == EINTR); if (n == -1) { _good = false; throw SysError("reading from file"); } if (n == 0) { _good = false; throw EndOfFile("unexpected end-of-file"); } + read += n; return n; } |