Skip to content

Commit b729453

Browse files
authored
Bug: when searching for LinuxBootFiles (#2454)
Empty path was being added to lookup paths for `LinuxBootFiles`. Worked since the path was often just `C:\ContainerPlat`, but fix it regardless. Also add check to make sure the `LinuxBootFiles` path found is also a directory. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
1 parent e3722b0 commit b729453

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/pkg/uvm/lcow.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ var lcowOSBootFilesOnce = sync.OnceValues(func() (string, error) {
1919
// first start with where containerd is, since there may be a leftover C:\ContainerPlat
2020
// directory from a prior install.
2121
paths := make([]string, 0, 2)
22-
if p, err := exec.LookPath("containerd.exe"); err != nil {
23-
paths = append(paths, p)
22+
if p, err := exec.LookPath("containerd.exe"); err == nil {
23+
paths = append(paths, filepath.Dir(p))
2424
}
2525
paths = append(paths, `C:\ContainerPlat`)
2626
for _, p := range paths {
2727
p = filepath.Join(p, "LinuxBootFiles")
28-
if _, err := os.Stat(p); err == nil {
29-
return p, nil
28+
if fi, err := os.Stat(p); err == nil && fi.IsDir() {
29+
return filepath.Abs(p)
3030
}
3131
}
3232
return "", nil

0 commit comments

Comments
 (0)