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>
This commit is contained in:
Sebastiaan van Stijn 2023-08-12 11:01:32 +02:00
parent a9e8110fe3
commit 48ea7ec970
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

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