1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Michael Crosby 2017-04-27 09:26:21 -07:00
parent e1101b1295
commit 169c013911
2 changed files with 10 additions and 6 deletions

View file

@ -22,10 +22,12 @@ func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) (ls []net.List
case "unix":
gid, err := lookupGID(socketGroup)
if err != nil {
if socketGroup != defaultSocketGroup {
return nil, err
if socketGroup != "" {
if socketGroup != defaultSocketGroup {
return nil, err
}
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
}
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
gid = os.Getgid()
}
l, err := sockets.NewUnixSocket(addr, gid)

View file

@ -35,10 +35,12 @@ func Init(proto, addr, socketGroup string, tlsConfig *tls.Config) ([]net.Listene
case "unix":
gid, err := lookupGID(socketGroup)
if err != nil {
if socketGroup != defaultSocketGroup {
return nil, err
if socketGroup != "" {
if socketGroup != defaultSocketGroup {
return nil, err
}
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
}
logrus.Warnf("could not change group %s to %s: %v", addr, defaultSocketGroup, err)
gid = os.Getgid()
}
l, err := sockets.NewUnixSocket(addr, gid)