aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-10-05 17:36:07 +0200
committerGitHub <noreply@github.com>2021-10-05 17:36:07 +0200
commitfd57e7074f2f7189bce0b525073ea507857ca44e (patch)
tree33c04ec5c803d8be86e7b9902dee2ff53d34a49f /src/libstore
parent3b7f4c7d9d124283cec7f7d42e0eca3e2de64d5a (diff)
parent223ab254c29313fff2a9af463baa2f0b68d7d83f (diff)
Merge pull request #5335 from edolstra/socket-paths
Support arbitrary-length socket paths
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/uds-remote-store.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/libstore/uds-remote-store.cc b/src/libstore/uds-remote-store.cc
index cfadccf68..02e81b022 100644
--- a/src/libstore/uds-remote-store.cc
+++ b/src/libstore/uds-remote-store.cc
@@ -65,16 +65,7 @@ ref<RemoteStore::Connection> UDSRemoteStore::openConnection()
throw SysError("cannot create Unix domain socket");
closeOnExec(conn->fd.get());
- string socketPath = path ? *path : settings.nixDaemonSocketFile;
-
- struct sockaddr_un addr;
- addr.sun_family = AF_UNIX;
- if (socketPath.size() + 1 >= sizeof(addr.sun_path))
- throw Error("socket path '%1%' is too long", socketPath);
- strcpy(addr.sun_path, socketPath.c_str());
-
- if (::connect(conn->fd.get(), (struct sockaddr *) &addr, sizeof(addr)) == -1)
- throw SysError("cannot connect to daemon at '%1%'", socketPath);
+ nix::connect(conn->fd.get(), path ? *path : settings.nixDaemonSocketFile);
conn->from.fd = conn->fd.get();
conn->to.fd = conn->fd.get();