File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ import (
77 "os/user"
88 "path/filepath"
99 "strings"
10- "syscall"
1110
1211 "github.com/BurntSushi/toml"
1312 "github.com/containers/storage/pkg/idtools"
13+ "github.com/containers/storage/pkg/system"
1414 "github.com/pkg/errors"
1515 "github.com/sirupsen/logrus"
1616)
@@ -72,19 +72,16 @@ func GetRootlessRuntimeDir(rootlessUid int) (string, error) {
7272 runtimeDir := os .Getenv ("XDG_RUNTIME_DIR" )
7373 if runtimeDir == "" {
7474 tmpDir := fmt .Sprintf ("/run/user/%d" , rootlessUid )
75- st , err := os .Stat (tmpDir )
76- if err == nil && int (st .Sys ().( * syscall. Stat_t ). Uid ) == os .Getuid () && st .Mode (). Perm () == 0700 {
75+ st , err := system .Stat (tmpDir )
76+ if err == nil && int (st .UID ()) == os .Getuid () && st .Mode () == 0700 {
7777 return tmpDir , nil
7878 }
7979 }
8080 tmpDir := fmt .Sprintf ("%s/%d" , os .TempDir (), rootlessUid )
8181 if err := os .MkdirAll (tmpDir , 0700 ); err != nil {
8282 logrus .Errorf ("failed to create %s: %v" , tmpDir , err )
8383 } else {
84- st , err := os .Stat (tmpDir )
85- if err == nil && int (st .Sys ().(* syscall.Stat_t ).Uid ) == os .Getuid () && st .Mode ().Perm () == 0700 {
86- return tmpDir , nil
87- }
84+ return tmpDir , nil
8885 }
8986 home , err := homeDir ()
9087 if err != nil {
You can’t perform that action at this time.
0 commit comments