Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request moby#38728 from AkihiroSuda/fix-rootless-stick-xdg
Browse files Browse the repository at this point in the history
dockerd: call StickRuntimeDirContents only in rootless mode
  • Loading branch information
thaJeztah authored Feb 14, 2019
2 parents 0111ee7 + 56bea90 commit 206004e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/dockerd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,12 @@ func (cli *DaemonCli) start(opts *daemonOptions) (err error) {
}()
}

// Set sticky bit if XDG_RUNTIME_DIR is set && the file is actually under XDG_RUNTIME_DIR
if _, err := homedir.StickRuntimeDirContents(potentiallyUnderRuntimeDir); err != nil {
// StickRuntimeDirContents returns nil error if XDG_RUNTIME_DIR is just unset
logrus.WithError(err).Warn("cannot set sticky bit on files under XDG_RUNTIME_DIR")
if cli.Config.IsRootless() {
// Set sticky bit if XDG_RUNTIME_DIR is set && the file is actually under XDG_RUNTIME_DIR
if _, err := homedir.StickRuntimeDirContents(potentiallyUnderRuntimeDir); err != nil {
// StickRuntimeDirContents returns nil error if XDG_RUNTIME_DIR is just unset
logrus.WithError(err).Warn("cannot set sticky bit on files under XDG_RUNTIME_DIR")
}
}

serverConfig, err := newAPIServerConfig(cli)
Expand Down

0 comments on commit 206004e

Please sign in to comment.