Explorar o código

Merge pull request #360 from thaJeztah/19.03_backport_fix_missing_dir_cleanup_file

[19.03 backport] Ensure parent dir exists for mount cleanup file
Sebastiaan van Stijn %!s(int64=5) %!d(string=hai) anos
pai
achega
6de2bd28df
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      daemon/daemon_unix.go

+ 4 - 0
daemon/daemon_unix.go

@@ -1265,6 +1265,10 @@ func setupDaemonRootPropagation(cfg *config.Config) error {
 		return nil
 	}
 
+	if err := os.MkdirAll(filepath.Dir(cleanupFile), 0700); err != nil {
+		return errors.Wrap(err, "error creating dir to store mount cleanup file")
+	}
+
 	if err := ioutil.WriteFile(cleanupFile, nil, 0600); err != nil {
 		return errors.Wrap(err, "error writing file to signal mount cleanup on shutdown")
 	}