From f9b8fc64b137b2177b9ac5b1db89aa3158e97b9f Mon Sep 17 00:00:00 2001 From: "Paul \"TBBle\" Hampson" Date: Fri, 24 Jul 2020 20:40:46 +1000 Subject: [PATCH] Give a name to the only mount we care about Signed-off-by: Paul "TBBle" Hampson --- snapshot/localmounter_windows.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/snapshot/localmounter_windows.go b/snapshot/localmounter_windows.go index 6b6db4ec..df2e99b6 100644 --- a/snapshot/localmounter_windows.go +++ b/snapshot/localmounter_windows.go @@ -25,25 +25,27 @@ func (lm *localMounter) Mount() (string, error) { return "", errors.Wrapf(errdefs.ErrNotImplemented, "request to mount %d layers, only 1 is supported", len(lm.mounts)) } - if lm.mounts[0].Type == "bind" || lm.mounts[0].Type == "rbind" { + m := lm.mounts[0] + + if m.Type == "bind" || m.Type == "rbind" { ro := false - for _, opt := range lm.mounts[0].Options { + for _, opt := range m.Options { if opt == "ro" { ro = true break } } if !ro { - return lm.mounts[0].Source, nil + return m.Source, nil } } // Windows mounts always activate in-place, so the target of the mount must be the source directory. // See https://github.com/containerd/containerd/pull/2366 - dir := lm.mounts[0].Source + dir := m.Source - if err := lm.mounts[0].Mount(dir); err != nil { - return "", errors.Wrapf(err, "failed to mount in-place: %v", lm.mounts[0]) + if err := m.Mount(dir); err != nil { + return "", errors.Wrapf(err, "failed to mount in-place: %v", m) } lm.target = dir return lm.target, nil