Przeglądaj źródła

libnetwork/osl: use filepath.Join() only when changing basedir

Use filepath.Join() only when the base-path is updated, instead of every
time it is accessed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 1 rok temu
rodzic
commit
48ea7ec970
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      libnetwork/osl/namespace_linux.go

+ 3 - 3
libnetwork/osl/namespace_linux.go

@@ -43,16 +43,16 @@ var (
 	gpmWg            sync.WaitGroup
 	gpmWg            sync.WaitGroup
 	gpmCleanupPeriod = 60 * time.Second
 	gpmCleanupPeriod = 60 * time.Second
 	gpmChan          = make(chan chan struct{})
 	gpmChan          = make(chan chan struct{})
-	prefix           = defaultPrefix
+	netnsBasePath    = filepath.Join(defaultPrefix, "netns")
 )
 )
 
 
 // SetBasePath sets the base url prefix for the ns path
 // SetBasePath sets the base url prefix for the ns path
 func SetBasePath(path string) {
 func SetBasePath(path string) {
-	prefix = path
+	netnsBasePath = filepath.Join(path, "netns")
 }
 }
 
 
 func basePath() string {
 func basePath() string {
-	return filepath.Join(prefix, "netns")
+	return netnsBasePath
 }
 }
 
 
 func createBasePath() {
 func createBasePath() {