From ba51100d64c18f627f97e606c4884ba2fb78dfa0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 16 Oct 2018 22:58:01 +0200 Subject: 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'. --- src/libstore/remote-store.hh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/libstore') diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index b488e34ce..9d768576b 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 openConnection() override; std::experimental::optional path; }; -- cgit v1.2.3