about summary refs log tree commit diff
path: root/src/libutil/serialise.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-23T18·43+0200
committerEelco Dolstra <edolstra@gmail.com>2017-10-23T18·50+0200
commit37fbfffd8e23cf9ca4038e6c4145583a811e91aa (patch)
tree4605d5cdd90bd1a9c5e796278bd40b0acb3ad93c /src/libutil/serialise.hh
parentf32cdc4fab1bff919c3d074a95e32a9934eb7386 (diff)
Pass all settings to build-remote
This ensures that command line flags such as --builders get passed
correctly.
Diffstat (limited to 'src/libutil/serialise.hh')
-rw-r--r--src/libutil/serialise.hh22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/libutil/serialise.hh b/src/libutil/serialise.hh
index 70b193941638..2ea5b6354ee9 100644
--- a/src/libutil/serialise.hh
+++ b/src/libutil/serialise.hh
@@ -92,7 +92,17 @@ struct FdSink : BufferedSink
     FdSink() : fd(-1) { }
     FdSink(int fd) : fd(fd) { }
     FdSink(FdSink&&) = default;
-    FdSink& operator=(FdSink&&) = default;
+
+    FdSink& operator=(FdSink && s)
+    {
+        flush();
+        fd = s.fd;
+        s.fd = -1;
+        warn = s.warn;
+        written = s.written;
+        return *this;
+    }
+
     ~FdSink();
 
     void write(const unsigned char * data, size_t len) override;
@@ -112,6 +122,16 @@ struct FdSource : BufferedSource
 
     FdSource() : fd(-1) { }
     FdSource(int fd) : fd(fd) { }
+    FdSource(FdSource&&) = default;
+
+    FdSource& operator=(FdSource && s)
+    {
+        fd = s.fd;
+        s.fd = -1;
+        read = s.read;
+        return *this;
+    }
+
     size_t readUnbuffered(unsigned char * data, size_t len) override;
     bool good() override;
 private: