|
@@ -1,5 +1,6 @@
|
|
import sys
|
|
import sys
|
|
import os
|
|
import os
|
|
|
|
+import socket
|
|
import stat
|
|
import stat
|
|
|
|
|
|
# Ensure that this is being run on a specific platform
|
|
# Ensure that this is being run on a specific platform
|
|
@@ -76,8 +77,13 @@ def create_fifo(source):
|
|
|
|
|
|
|
|
|
|
def create_socket(source):
|
|
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__':
|
|
if __name__ == '__main__':
|