diff options
author | Shawn O. Pearce <sop@google.com> | 2009-04-21 08:05:27 -0700 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2009-04-21 08:05:27 -0700 |
commit | d63bbf44dc22994ad3cdd73cf852f3d91d87b3f8 (patch) | |
tree | f3fca75ef50280259369c607a7320ba5f02dad02 /git_command.py | |
parent | a8421a128a2f0a5e6dcca7e37e36ceb63c9291c4 (diff) | |
download | git-repo-d63bbf44dc22994ad3cdd73cf852f3d91d87b3f8.tar.gz |
Work around 'ControlPath too long' on Mac OS X
Mac OS X sets TMPDIR to a very long path within /var, so long
that a socket created in that location is too big for a struct
sockaddr_un on the platform, resulting in OpenSSH being unable
to create or bind to a socket in that location.
Instead we try to use the very short and very common /tmp, but
fall back to the guessed default if /tmp does not exist.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'git_command.py')
-rw-r--r-- | git_command.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/git_command.py b/git_command.py index 954bebad..7ff1abac 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -35,8 +35,11 @@ def _ssh_sock(create=True): | |||
35 | if _ssh_sock_path is None: | 35 | if _ssh_sock_path is None: |
36 | if not create: | 36 | if not create: |
37 | return None | 37 | return None |
38 | dir = '/tmp' | ||
39 | if not os.path.exists(dir): | ||
40 | dir = tempfile.gettempdir() | ||
38 | _ssh_sock_path = os.path.join( | 41 | _ssh_sock_path = os.path.join( |
39 | tempfile.mkdtemp('', 'ssh-'), | 42 | tempfile.mkdtemp('', 'ssh-', dir), |
40 | 'master-%r@%h:%p') | 43 | 'master-%r@%h:%p') |
41 | return _ssh_sock_path | 44 | return _ssh_sock_path |
42 | 45 | ||