Explorar o código

Merge pull request #38728 from AkihiroSuda/fix-rootless-stick-xdg

dockerd: call StickRuntimeDirContents only in rootless mode
Sebastiaan van Stijn %!s(int64=6) %!d(string=hai) anos
pai
achega
206004e3a7
Modificáronse 1 ficheiros con 6 adicións e 4 borrados
  1. 6 4
      cmd/dockerd/daemon.go

+ 6 - 4
cmd/dockerd/daemon.go

@@ -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)
 	serverConfig, err := newAPIServerConfig(cli)