================ @@ -320,16 +320,26 @@ struct scoped_test_env // allow tests to call this unguarded. #if !defined(__FreeBSD__) && !defined(__APPLE__) && !defined(_WIN32) std::string create_socket(std::string file) { - file = sanitize_path(std::move(file)); - - ::sockaddr_un address; - address.sun_family = AF_UNIX; - assert(file.size() <= sizeof(address.sun_path)); - ::strncpy(address.sun_path, file.c_str(), sizeof(address.sun_path)); - int fd = ::socket(AF_UNIX, SOCK_STREAM, 0); - ::bind(fd, reinterpret_cast<::sockaddr*>(&address), sizeof(address)); - return file; + file = sanitize_path(std::move(file)); + + ::sockaddr_un address; + address.sun_family = AF_UNIX; + +// If file.size() is too big, try to create a file directly inside +// /tmp to make sure file path is short enough. +// Android platform warns about tmpnam, since the problem does not appear +// on Android, let's not apply it for Android. ---------------- mordante wrote:
Not too happy about this, but since we assert afterwards it will fail the test. If that happens we can investigate. https://github.com/llvm/llvm-project/pull/77058 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits