Browse Source

Move TMPDIR symlink cleanup to NewDaemon

Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
Solomon Hykes 11 years ago
parent
commit
a7d8c732b1
2 changed files with 7 additions and 7 deletions
  1. 7 0
      daemon/daemon.go
  2. 0 7
      docker/docker.go

+ 7 - 0
daemon/daemon.go

@@ -767,6 +767,13 @@ func NewDaemonFromDirectory(config *daemonconfig.Config, eng *engine.Engine) (*D
 	if os.Geteuid() != 0 {
 		log.Fatalf("The Docker daemon needs to be run as root")
 	}
+	// set up the TempDir to use a canonical path
+	tmp := os.TempDir()
+	realTmp, err := utils.ReadSymlinkedDirectory(tmp)
+	if err != nil {
+		log.Fatalf("Unable to get the full path to the TempDir (%s): %s", tmp, err)
+	}
+	os.Setenv("TMPDIR", realTmp)
 	if !config.EnableSelinuxSupport {
 		selinuxSetDisabled()
 	}

+ 0 - 7
docker/docker.go

@@ -119,13 +119,6 @@ func main() {
 			return
 		}
 
-		// set up the TempDir to use a canonical path
-		tmp := os.TempDir()
-		realTmp, err := utils.ReadSymlinkedDirectory(tmp)
-		if err != nil {
-			log.Fatalf("Unable to get the full path to the TempDir (%s): %s", tmp, err)
-		}
-		os.Setenv("TMPDIR", realTmp)
 
 		// get the canonical path to the Docker root directory
 		root := *flRoot