- // We use mkstemp() just to avoid warnings about mktemp,
- // but we need to remove the file to let the socket code bind to it.
- char serverPath[] = "/tmp/SocketAddressTest.server.XXXXXX";
- int serverPathFd = mkstemp(serverPath);
- EXPECT_GE(serverPathFd, 0);
- char clientPath[] = "/tmp/SocketAddressTest.client.XXXXXX";
- int clientPathFd = mkstemp(clientPath);
- EXPECT_GE(clientPathFd, 0);
-
- int rc = unlink(serverPath);
- EXPECT_EQ(rc, 0);
- rc = unlink(clientPath);
- EXPECT_EQ(rc, 0);
+ TemporaryDirectory tempDirectory("SocketAddressTest");
+ std::string serverPath = (tempDirectory.path() / "server").string();
+ std::string clientPath = (tempDirectory.path() / "client").string();