aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/serialise.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-27 14:40:08 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-07-27 14:40:08 +0000
commit78466bcb2fd07cf19a657e04da1a1dddde1bb57e (patch)
tree2c3495fb3b70dcec78af14ddc695212e99c2a26b /src/libutil/serialise.cc
parent5055c595bd08c7aea494767d309645e8f3ef6f3d (diff)
parentd5bb67cfa4da130a9949a9b4eb8aba6cb74ea5c7 (diff)
Merge branch 'optional-derivation-output-storepath' into ca-derivation-data-types
Diffstat (limited to 'src/libutil/serialise.cc')
-rw-r--r--src/libutil/serialise.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libutil/serialise.cc b/src/libutil/serialise.cc
index c8b71188f..00c945113 100644
--- a/src/libutil/serialise.cc
+++ b/src/libutil/serialise.cc
@@ -322,5 +322,18 @@ void StringSink::operator () (const unsigned char * data, size_t len)
s->append((const char *) data, len);
}
+size_t ChainSource::read(unsigned char * data, size_t len)
+{
+ if (useSecond) {
+ return source2.read(data, len);
+ } else {
+ try {
+ return source1.read(data, len);
+ } catch (EndOfFile &) {
+ useSecond = true;
+ return this->read(data, len);
+ }
+ }
+}
}