about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-10-16T20·58+0200
committerEelco Dolstra <edolstra@gmail.com>2018-10-16T20·58+0200
commitba51100d64c18f627f97e606c4884ba2fb78dfa0 (patch)
tree117e40f16d10972e5ae76772fd67c7b337a7b246
parent9617a043541d77d79e4f20f9676aae63de72f45d (diff)
Get rid of UDSRemoteStore::Connection
Since its superclass RemoteStore::Connection contains 'to' and 'from'
fields that refer to the file descriptor maintained in the subclass,
it was possible for the flush() call in Connection::~Connection() to
write to a closed file descriptor (or worse, a file descriptor now
referencing another file). So make sure that the file descriptor
survives 'to' and 'from'.
-rw-r--r--src/libstore/remote-store.hh6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index b488e34ce263..9d768576bad8 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -103,6 +103,7 @@ protected:
 
     struct Connection
     {
+        AutoCloseFD fd;
         FdSink to;
         FdSource from;
         unsigned int daemonVersion;
@@ -140,11 +141,6 @@ public:
 
 private:
 
-    struct Connection : RemoteStore::Connection
-    {
-        AutoCloseFD fd;
-    };
-
     ref<RemoteStore::Connection> openConnection() override;
     std::experimental::optional<std::string> path;
 };