mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-18 02:48:40 +00:00
safesocket: make some effort to create parent directory of sock
This commit is contained in:
parent
383d86df5f
commit
b3d9eab1fe
@ -10,6 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(apenwarr): handle magic cookie auth
|
// TODO(apenwarr): handle magic cookie auth
|
||||||
@ -39,6 +40,7 @@ func listen(path string, port uint16) (ln net.Listener, _ uint16, err error) {
|
|||||||
return nil, 0, fmt.Errorf("%v: address already in use", path)
|
return nil, 0, fmt.Errorf("%v: address already in use", path)
|
||||||
}
|
}
|
||||||
_ = os.Remove(path)
|
_ = os.Remove(path)
|
||||||
|
os.MkdirAll(filepath.Dir(path), 0755) // best effort
|
||||||
pipe, err := net.Listen("unix", path)
|
pipe, err := net.Listen("unix", path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, err
|
return nil, 0, err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user