spec, libcni, pkg/invoke: Use OS-agnostic separator when parsing CNI_PATH
Hardcoding the list separator character as ":" causes CNI to fail when parsing CNI_PATH on other operating systems. For example, Windows uses ";" as list separator because ":" can legally appear in paths such as "C:\path\to\file". This change replaces use of ":" with OS-agnostic APIs or os.PathListSeparator. Fixes #358
This commit is contained in:
@ -18,7 +18,6 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/containernetworking/cni/libcni"
|
||||
)
|
||||
@ -51,7 +50,7 @@ func main() {
|
||||
netns := os.Args[3]
|
||||
|
||||
cninet := &libcni.CNIConfig{
|
||||
Path: strings.Split(os.Getenv(EnvCNIPath), ":"),
|
||||
Path: filepath.SplitList(os.Getenv(EnvCNIPath)),
|
||||
}
|
||||
|
||||
rt := &libcni.RuntimeConf{
|
||||
|
Reference in New Issue
Block a user