@@ -20,14 +20,15 @@ import (
20
20
"context"
21
21
"os"
22
22
"path/filepath"
23
+ "runtime"
23
24
"strings"
24
25
26
+ "github.com/pkg/errors"
27
+
25
28
"github.com/containerd/containerd"
26
29
"github.com/containerd/containerd/namespaces"
27
30
"github.com/opencontainers/go-digest"
28
- "github.com/pkg/errors"
29
31
"github.com/urfave/cli/v2"
30
- "golang.org/x/sys/unix"
31
32
)
32
33
33
34
func newClient (clicontext * cli.Context ) (* containerd.Client , context.Context , context.CancelFunc , error ) {
@@ -54,15 +55,6 @@ func newClient(clicontext *cli.Context) (*containerd.Client, context.Context, co
54
55
return client , ctx , cancel , nil
55
56
}
56
57
57
- func isSocketAccessible (s string ) error {
58
- abs , err := filepath .Abs (s )
59
- if err != nil {
60
- return err
61
- }
62
- // set AT_EACCESS to allow running nerdctl as a setuid binary
63
- return unix .Faccessat (- 1 , abs , unix .R_OK | unix .W_OK , unix .AT_EACCESS )
64
- }
65
-
66
58
// getDataStore returns a string like "/var/lib/nerdctl/1935db59".
67
59
// "1935db9" is from `$(echo -n "/run/containerd/containerd.sock" | sha256sum | cut -c1-8)``
68
60
func getDataStore (clicontext * cli.Context ) (string , error ) {
@@ -84,7 +76,10 @@ func getDataStore(clicontext *cli.Context) (string, error) {
84
76
func getAddrHash (addr string ) (string , error ) {
85
77
const addrHashLen = 8
86
78
87
- addr = strings .TrimPrefix (addr , "unix://" )
79
+ if runtime .GOOS != "windows" {
80
+ addr = strings .TrimPrefix (addr , "unix://" )
81
+ }
82
+
88
83
var err error
89
84
addr , err = filepath .EvalSymlinks (addr )
90
85
if err != nil {
0 commit comments