8000 Don't error with empty group · moby/moby@169c013 · GitHub
[go: up one dir, main page]

Skip to content

Commit 169c013

Browse files
committed
Don't error with empty group
Don't error if no group is specified, as this was the prior API. Also don't return a docker specific error message as this is in `/pkg` and used by other projects. Just set the default group for the current user/group consuming the package. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
1 parent e1101b1 commit 169c013

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pkg/listeners/listeners_solaris.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) (ls []net.List
2222
case "unix":
2323
gid, err := lookupGID(socketGroup)
2424
if err != nil {
25-
if socketGroup != defaultSocketGroup {
26-
return nil, err
25+
if socketGroup != "" {
26+
if socketGroup != defaultSocketGroup {
27+
return nil, err
28+
}
29+
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
2730
}
28-
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
2931
gid = os.Getgid()
3032
}
3133
l, err := sockets.NewUnixSocket(addr, gid)

pkg/listeners/listeners_unix.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) ([]net.Listene
3535
case "unix":
3636
gid, err := lookupGID(socketGroup)
3737
if err != nil {
38-
if socketGroup != defaultSocketGroup {
39-
return nil, err
38+
if socketGroup != "" {
39+
if socketGroup != defaultSocketGroup {
40+
return nil, err
41+
}
42+
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
4043
}
41-
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
4244
gid = os.Getgid()
4345
}
4446
l, err := sockets.NewUnixSocket(addr, gid)

0 commit comments

Comments
 (0)
0