Skip to content

Commit

Permalink
fix: change default sockfile path
Browse files Browse the repository at this point in the history
  • Loading branch information
buptczq committed Nov 20, 2020
1 parent aad9f02 commit 73810bd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/cygwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ func cygwinHandshake(conn net.Conn, uuid []byte) error {
}

func (s *Cygwin) Run(ctx context.Context, handler func(conn io.ReadWriteCloser)) error {
sockfile, err := filepath.Abs(CYGWIN_SOCK)
home, err := os.UserHomeDir()
if err != nil {
return err
}
sockfile := filepath.Join(home, CYGWIN_SOCK)
s.sockfile = sockfile
// listen tcp socket
l, err := net.Listen("tcp", "localhost:0")
Expand Down
3 changes: 2 additions & 1 deletion app/wsl.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ type WSL struct {
}

func listenUnixSock(filename string) (string, net.Listener, error) {
path, err := filepath.Abs(filename)
home, err := os.UserHomeDir()
if err != nil {
return "", nil, err
}
path := filepath.Join(home, CYGWIN_SOCK)
os.Remove(path)
l, err := net.Listen("unix", path)
return path, l, err
Expand Down
8 changes: 7 additions & 1 deletion sshagent/certificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ import (
"golang.org/x/crypto/ssh"
"io/ioutil"
"os"
"path/filepath"
)

func loadCertFile(filename string) (*ssh.Certificate, error) {
file, err := os.Open(filename)
home, err := os.UserHomeDir()
if err != nil {
return nil, err
}
path := filepath.Join(home, filename)
file, err := os.Open(path)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 73810bd

Please sign in to comment.