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'.
This commit is contained in:
Eelco Dolstra 2018-10-16 22:58:01 +02:00
parent 9617a04354
commit ba51100d64

View file

@ -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;
};