Skip to content

Commit 4ab3e7a

Browse files
author
fupan.lfp
committed
runtime: fix the issue of create new socket with abstract address
For the abstract socket adress there's no need to chmod the address's file, cause the file didn't exist actually. Signed-off-by: Fupan Li <[email protected]>
1 parent e830c53 commit 4ab3e7a

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

runtime/v2/shim/util_unix.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ func NewSocket(address string) (*net.UnixListener, error) {
9090
sock = socket(address)
9191
path = sock.path()
9292
)
93-
if !sock.isAbstract() {
93+
94+
isAbstract := sock.isAbstract()
95+
96+
if !isAbstract {
9497
if err := os.MkdirAll(filepath.Dir(path), 0600); err != nil {
9598
return nil, errors.Wrapf(err, "%s", path)
9699
}
@@ -99,10 +102,13 @@ func NewSocket(address string) (*net.UnixListener, error) {
99102
if err != nil {
100103
return nil, err
101104
}
102-
if err := os.Chmod(path, 0600); err != nil {
103-
os.Remove(sock.path())
104-
l.Close()
105-
return nil, err
105+
106+
if !isAbstract {
107+
if err := os.Chmod(path, 0600); err != nil {
108+
os.Remove(sock.path())
109+
l.Close()
110+
return nil, err
111+
}
106112
}
107113
return l.(*net.UnixListener), nil
108114
}

0 commit comments

Comments
 (0)