[PATCH] D55576: [libcxx] [test] [support] Use socket()+bind() to create unix sockets portably
Michał Górny via Phabricator
reviews at reviews.llvm.org
Sun Dec 16 07:16:17 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCXX349305: [test] [support] Use socket()+bind() to create unix sockets portably (authored by mgorny, committed by ).
Repository:
rCXX libc++
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D55576/new/
https://reviews.llvm.org/D55576
Files:
test/support/filesystem_dynamic_test_helper.py
Index: test/support/filesystem_dynamic_test_helper.py
===================================================================
--- test/support/filesystem_dynamic_test_helper.py
+++ test/support/filesystem_dynamic_test_helper.py
@@ -1,5 +1,6 @@
import sys
import os
+import socket
import stat
# Ensure that this is being run on a specific platform
@@ -76,8 +77,13 @@
def create_socket(source):
- mode = 0o600 | stat.S_IFSOCK
- os.mknod(sanitize(source), mode)
+ sock = socket.socket(socket.AF_UNIX)
+ sanitized_source = sanitize(source)
+ # AF_UNIX sockets may have very limited path length, so split it
+ # into chdir call (with technically unlimited length) followed
+ # by bind() relative to the directory
+ os.chdir(os.path.dirname(sanitized_source))
+ sock.bind(os.path.basename(sanitized_source))
if __name__ == '__main__':
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55576.178396.patch
Type: text/x-patch
Size: 868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20181216/01b81548/attachment.bin>
More information about the libcxx-commits
mailing list